sysctl.c 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226
  1. /*
  2. * sysctl.c: General linux system control interface
  3. *
  4. * Begun 24 March 1995, Stephen Tweedie
  5. * Added /proc support, Dec 1995
  6. * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
  7. * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
  8. * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
  9. * Dynamic registration fixes, Stephen Tweedie.
  10. * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
  11. * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
  12. * Horn.
  13. * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
  14. * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
  15. * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
  16. * Wendling.
  17. * The list_for_each() macro wasn't appropriate for the sysctl loop.
  18. * Removed it and replaced it with older style, 03/23/00, Bill Wendling
  19. */
  20. #include <linux/module.h>
  21. #include <linux/aio.h>
  22. #include <linux/mm.h>
  23. #include <linux/swap.h>
  24. #include <linux/slab.h>
  25. #include <linux/sysctl.h>
  26. #include <linux/bitmap.h>
  27. #include <linux/signal.h>
  28. #include <linux/printk.h>
  29. #include <linux/proc_fs.h>
  30. #include <linux/security.h>
  31. #include <linux/ctype.h>
  32. #include <linux/kmemleak.h>
  33. #include <linux/fs.h>
  34. #include <linux/init.h>
  35. #include <linux/kernel.h>
  36. #include <linux/kobject.h>
  37. #include <linux/net.h>
  38. #include <linux/sysrq.h>
  39. #include <linux/highuid.h>
  40. #include <linux/writeback.h>
  41. #include <linux/ratelimit.h>
  42. #include <linux/compaction.h>
  43. #include <linux/hugetlb.h>
  44. #include <linux/initrd.h>
  45. #include <linux/key.h>
  46. #include <linux/times.h>
  47. #include <linux/limits.h>
  48. #include <linux/dcache.h>
  49. #include <linux/dnotify.h>
  50. #include <linux/syscalls.h>
  51. #include <linux/vmstat.h>
  52. #include <linux/nfs_fs.h>
  53. #include <linux/acpi.h>
  54. #include <linux/reboot.h>
  55. #include <linux/ftrace.h>
  56. #include <linux/perf_event.h>
  57. #include <linux/kprobes.h>
  58. #include <linux/pipe_fs_i.h>
  59. #include <linux/oom.h>
  60. #include <linux/kmod.h>
  61. #include <linux/capability.h>
  62. #include <linux/binfmts.h>
  63. #include <linux/sched/sysctl.h>
  64. #include <linux/sched/coredump.h>
  65. #include <linux/kexec.h>
  66. #include <linux/bpf.h>
  67. #include <linux/mount.h>
  68. #include <linux/pipe_fs_i.h>
  69. #include <linux/uaccess.h>
  70. #include <asm/processor.h>
  71. #ifdef CONFIG_X86
  72. #include <asm/nmi.h>
  73. #include <asm/stacktrace.h>
  74. #include <asm/io.h>
  75. #endif
  76. #ifdef CONFIG_SPARC
  77. #include <asm/setup.h>
  78. #endif
  79. #ifdef CONFIG_BSD_PROCESS_ACCT
  80. #include <linux/acct.h>
  81. #endif
  82. #ifdef CONFIG_RT_MUTEXES
  83. #include <linux/rtmutex.h>
  84. #endif
  85. #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
  86. #include <linux/lockdep.h>
  87. #endif
  88. #ifdef CONFIG_CHR_DEV_SG
  89. #include <scsi/sg.h>
  90. #endif
  91. #ifdef CONFIG_LOCKUP_DETECTOR
  92. #include <linux/nmi.h>
  93. #endif
  94. #if defined(CONFIG_SYSCTL)
  95. /* External variables not in a header file. */
  96. extern int suid_dumpable;
  97. #ifdef CONFIG_COREDUMP
  98. extern int core_uses_pid;
  99. extern char core_pattern[];
  100. extern unsigned int core_pipe_limit;
  101. #endif
  102. extern int pid_max;
  103. extern int pid_max_min, pid_max_max;
  104. extern int percpu_pagelist_fraction;
  105. extern int latencytop_enabled;
  106. extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
  107. #ifndef CONFIG_MMU
  108. extern int sysctl_nr_trim_pages;
  109. #endif
  110. /* Constants used for minimum and maximum */
  111. #ifdef CONFIG_LOCKUP_DETECTOR
  112. static int sixty = 60;
  113. #endif
  114. static int __maybe_unused neg_one = -1;
  115. static int zero;
  116. static int __maybe_unused one = 1;
  117. static int __maybe_unused two = 2;
  118. static int __maybe_unused four = 4;
  119. static unsigned long one_ul = 1;
  120. static int one_hundred = 100;
  121. static int one_thousand = 1000;
  122. #ifdef CONFIG_PRINTK
  123. static int ten_thousand = 10000;
  124. #endif
  125. #ifdef CONFIG_PERF_EVENTS
  126. static int six_hundred_forty_kb = 640 * 1024;
  127. #endif
  128. /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
  129. static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
  130. /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  131. static int maxolduid = 65535;
  132. static int minolduid;
  133. static int ngroups_max = NGROUPS_MAX;
  134. static const int cap_last_cap = CAP_LAST_CAP;
  135. /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
  136. #ifdef CONFIG_DETECT_HUNG_TASK
  137. static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
  138. #endif
  139. #ifdef CONFIG_INOTIFY_USER
  140. #include <linux/inotify.h>
  141. #endif
  142. #ifdef CONFIG_SPARC
  143. #endif
  144. #ifdef __hppa__
  145. extern int pwrsw_enabled;
  146. #endif
  147. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  148. extern int unaligned_enabled;
  149. #endif
  150. #ifdef CONFIG_IA64
  151. extern int unaligned_dump_stack;
  152. #endif
  153. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  154. extern int no_unaligned_warning;
  155. #endif
  156. #ifdef CONFIG_PROC_SYSCTL
  157. /**
  158. * enum sysctl_writes_mode - supported sysctl write modes
  159. *
  160. * @SYSCTL_WRITES_LEGACY: each write syscall must fully contain the sysctl value
  161. * to be written, and multiple writes on the same sysctl file descriptor
  162. * will rewrite the sysctl value, regardless of file position. No warning
  163. * is issued when the initial position is not 0.
  164. * @SYSCTL_WRITES_WARN: same as above but warn when the initial file position is
  165. * not 0.
  166. * @SYSCTL_WRITES_STRICT: writes to numeric sysctl entries must always be at
  167. * file position 0 and the value must be fully contained in the buffer
  168. * sent to the write syscall. If dealing with strings respect the file
  169. * position, but restrict this to the max length of the buffer, anything
  170. * passed the max lenght will be ignored. Multiple writes will append
  171. * to the buffer.
  172. *
  173. * These write modes control how current file position affects the behavior of
  174. * updating sysctl values through the proc interface on each write.
  175. */
  176. enum sysctl_writes_mode {
  177. SYSCTL_WRITES_LEGACY = -1,
  178. SYSCTL_WRITES_WARN = 0,
  179. SYSCTL_WRITES_STRICT = 1,
  180. };
  181. static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
  182. static int proc_do_cad_pid(struct ctl_table *table, int write,
  183. void __user *buffer, size_t *lenp, loff_t *ppos);
  184. static int proc_taint(struct ctl_table *table, int write,
  185. void __user *buffer, size_t *lenp, loff_t *ppos);
  186. #endif
  187. #ifdef CONFIG_PRINTK
  188. static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
  189. void __user *buffer, size_t *lenp, loff_t *ppos);
  190. #endif
  191. static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  192. void __user *buffer, size_t *lenp, loff_t *ppos);
  193. #ifdef CONFIG_COREDUMP
  194. static int proc_dostring_coredump(struct ctl_table *table, int write,
  195. void __user *buffer, size_t *lenp, loff_t *ppos);
  196. #endif
  197. static int proc_dopipe_max_size(struct ctl_table *table, int write,
  198. void __user *buffer, size_t *lenp, loff_t *ppos);
  199. #ifdef CONFIG_MAGIC_SYSRQ
  200. /* Note: sysrq code uses it's own private copy */
  201. static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
  202. static int sysrq_sysctl_handler(struct ctl_table *table, int write,
  203. void __user *buffer, size_t *lenp,
  204. loff_t *ppos)
  205. {
  206. int error;
  207. error = proc_dointvec(table, write, buffer, lenp, ppos);
  208. if (error)
  209. return error;
  210. if (write)
  211. sysrq_toggle_support(__sysrq_enabled);
  212. return 0;
  213. }
  214. #endif
  215. static struct ctl_table kern_table[];
  216. static struct ctl_table vm_table[];
  217. static struct ctl_table fs_table[];
  218. static struct ctl_table debug_table[];
  219. static struct ctl_table dev_table[];
  220. extern struct ctl_table random_table[];
  221. #ifdef CONFIG_EPOLL
  222. extern struct ctl_table epoll_table[];
  223. #endif
  224. #ifdef CONFIG_FW_LOADER_USER_HELPER
  225. extern struct ctl_table firmware_config_table[];
  226. #endif
  227. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  228. int sysctl_legacy_va_layout;
  229. #endif
  230. /* The default sysctl tables: */
  231. static struct ctl_table sysctl_base_table[] = {
  232. {
  233. .procname = "kernel",
  234. .mode = 0555,
  235. .child = kern_table,
  236. },
  237. {
  238. .procname = "vm",
  239. .mode = 0555,
  240. .child = vm_table,
  241. },
  242. {
  243. .procname = "fs",
  244. .mode = 0555,
  245. .child = fs_table,
  246. },
  247. {
  248. .procname = "debug",
  249. .mode = 0555,
  250. .child = debug_table,
  251. },
  252. {
  253. .procname = "dev",
  254. .mode = 0555,
  255. .child = dev_table,
  256. },
  257. { }
  258. };
  259. #ifdef CONFIG_SCHED_DEBUG
  260. static int min_sched_granularity_ns = 100000; /* 100 usecs */
  261. static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
  262. static int min_wakeup_granularity_ns; /* 0 usecs */
  263. static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
  264. #ifdef CONFIG_SMP
  265. static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
  266. static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
  267. #endif /* CONFIG_SMP */
  268. #endif /* CONFIG_SCHED_DEBUG */
  269. #ifdef CONFIG_COMPACTION
  270. static int min_extfrag_threshold;
  271. static int max_extfrag_threshold = 1000;
  272. #endif
  273. static struct ctl_table kern_table[] = {
  274. {
  275. .procname = "sched_child_runs_first",
  276. .data = &sysctl_sched_child_runs_first,
  277. .maxlen = sizeof(unsigned int),
  278. .mode = 0644,
  279. .proc_handler = proc_dointvec,
  280. },
  281. #ifdef CONFIG_SCHED_DEBUG
  282. {
  283. .procname = "sched_min_granularity_ns",
  284. .data = &sysctl_sched_min_granularity,
  285. .maxlen = sizeof(unsigned int),
  286. .mode = 0644,
  287. .proc_handler = sched_proc_update_handler,
  288. .extra1 = &min_sched_granularity_ns,
  289. .extra2 = &max_sched_granularity_ns,
  290. },
  291. {
  292. .procname = "sched_latency_ns",
  293. .data = &sysctl_sched_latency,
  294. .maxlen = sizeof(unsigned int),
  295. .mode = 0644,
  296. .proc_handler = sched_proc_update_handler,
  297. .extra1 = &min_sched_granularity_ns,
  298. .extra2 = &max_sched_granularity_ns,
  299. },
  300. {
  301. .procname = "sched_wakeup_granularity_ns",
  302. .data = &sysctl_sched_wakeup_granularity,
  303. .maxlen = sizeof(unsigned int),
  304. .mode = 0644,
  305. .proc_handler = sched_proc_update_handler,
  306. .extra1 = &min_wakeup_granularity_ns,
  307. .extra2 = &max_wakeup_granularity_ns,
  308. },
  309. #ifdef CONFIG_SMP
  310. {
  311. .procname = "sched_tunable_scaling",
  312. .data = &sysctl_sched_tunable_scaling,
  313. .maxlen = sizeof(enum sched_tunable_scaling),
  314. .mode = 0644,
  315. .proc_handler = sched_proc_update_handler,
  316. .extra1 = &min_sched_tunable_scaling,
  317. .extra2 = &max_sched_tunable_scaling,
  318. },
  319. {
  320. .procname = "sched_migration_cost_ns",
  321. .data = &sysctl_sched_migration_cost,
  322. .maxlen = sizeof(unsigned int),
  323. .mode = 0644,
  324. .proc_handler = proc_dointvec,
  325. },
  326. {
  327. .procname = "sched_nr_migrate",
  328. .data = &sysctl_sched_nr_migrate,
  329. .maxlen = sizeof(unsigned int),
  330. .mode = 0644,
  331. .proc_handler = proc_dointvec,
  332. },
  333. {
  334. .procname = "sched_time_avg_ms",
  335. .data = &sysctl_sched_time_avg,
  336. .maxlen = sizeof(unsigned int),
  337. .mode = 0644,
  338. .proc_handler = proc_dointvec_minmax,
  339. .extra1 = &one,
  340. },
  341. #ifdef CONFIG_SCHEDSTATS
  342. {
  343. .procname = "sched_schedstats",
  344. .data = NULL,
  345. .maxlen = sizeof(unsigned int),
  346. .mode = 0644,
  347. .proc_handler = sysctl_schedstats,
  348. .extra1 = &zero,
  349. .extra2 = &one,
  350. },
  351. #endif /* CONFIG_SCHEDSTATS */
  352. #endif /* CONFIG_SMP */
  353. #ifdef CONFIG_NUMA_BALANCING
  354. {
  355. .procname = "numa_balancing_scan_delay_ms",
  356. .data = &sysctl_numa_balancing_scan_delay,
  357. .maxlen = sizeof(unsigned int),
  358. .mode = 0644,
  359. .proc_handler = proc_dointvec,
  360. },
  361. {
  362. .procname = "numa_balancing_scan_period_min_ms",
  363. .data = &sysctl_numa_balancing_scan_period_min,
  364. .maxlen = sizeof(unsigned int),
  365. .mode = 0644,
  366. .proc_handler = proc_dointvec,
  367. },
  368. {
  369. .procname = "numa_balancing_scan_period_max_ms",
  370. .data = &sysctl_numa_balancing_scan_period_max,
  371. .maxlen = sizeof(unsigned int),
  372. .mode = 0644,
  373. .proc_handler = proc_dointvec,
  374. },
  375. {
  376. .procname = "numa_balancing_scan_size_mb",
  377. .data = &sysctl_numa_balancing_scan_size,
  378. .maxlen = sizeof(unsigned int),
  379. .mode = 0644,
  380. .proc_handler = proc_dointvec_minmax,
  381. .extra1 = &one,
  382. },
  383. {
  384. .procname = "numa_balancing",
  385. .data = NULL, /* filled in by handler */
  386. .maxlen = sizeof(unsigned int),
  387. .mode = 0644,
  388. .proc_handler = sysctl_numa_balancing,
  389. .extra1 = &zero,
  390. .extra2 = &one,
  391. },
  392. #endif /* CONFIG_NUMA_BALANCING */
  393. #endif /* CONFIG_SCHED_DEBUG */
  394. {
  395. .procname = "sched_rt_period_us",
  396. .data = &sysctl_sched_rt_period,
  397. .maxlen = sizeof(unsigned int),
  398. .mode = 0644,
  399. .proc_handler = sched_rt_handler,
  400. },
  401. {
  402. .procname = "sched_rt_runtime_us",
  403. .data = &sysctl_sched_rt_runtime,
  404. .maxlen = sizeof(int),
  405. .mode = 0644,
  406. .proc_handler = sched_rt_handler,
  407. },
  408. {
  409. .procname = "sched_rr_timeslice_ms",
  410. .data = &sysctl_sched_rr_timeslice,
  411. .maxlen = sizeof(int),
  412. .mode = 0644,
  413. .proc_handler = sched_rr_handler,
  414. },
  415. #ifdef CONFIG_SCHED_AUTOGROUP
  416. {
  417. .procname = "sched_autogroup_enabled",
  418. .data = &sysctl_sched_autogroup_enabled,
  419. .maxlen = sizeof(unsigned int),
  420. .mode = 0644,
  421. .proc_handler = proc_dointvec_minmax,
  422. .extra1 = &zero,
  423. .extra2 = &one,
  424. },
  425. #endif
  426. #ifdef CONFIG_CFS_BANDWIDTH
  427. {
  428. .procname = "sched_cfs_bandwidth_slice_us",
  429. .data = &sysctl_sched_cfs_bandwidth_slice,
  430. .maxlen = sizeof(unsigned int),
  431. .mode = 0644,
  432. .proc_handler = proc_dointvec_minmax,
  433. .extra1 = &one,
  434. },
  435. #endif
  436. #ifdef CONFIG_PROVE_LOCKING
  437. {
  438. .procname = "prove_locking",
  439. .data = &prove_locking,
  440. .maxlen = sizeof(int),
  441. .mode = 0644,
  442. .proc_handler = proc_dointvec,
  443. },
  444. #endif
  445. #ifdef CONFIG_LOCK_STAT
  446. {
  447. .procname = "lock_stat",
  448. .data = &lock_stat,
  449. .maxlen = sizeof(int),
  450. .mode = 0644,
  451. .proc_handler = proc_dointvec,
  452. },
  453. #endif
  454. {
  455. .procname = "panic",
  456. .data = &panic_timeout,
  457. .maxlen = sizeof(int),
  458. .mode = 0644,
  459. .proc_handler = proc_dointvec,
  460. },
  461. #ifdef CONFIG_COREDUMP
  462. {
  463. .procname = "core_uses_pid",
  464. .data = &core_uses_pid,
  465. .maxlen = sizeof(int),
  466. .mode = 0644,
  467. .proc_handler = proc_dointvec,
  468. },
  469. {
  470. .procname = "core_pattern",
  471. .data = core_pattern,
  472. .maxlen = CORENAME_MAX_SIZE,
  473. .mode = 0644,
  474. .proc_handler = proc_dostring_coredump,
  475. },
  476. {
  477. .procname = "core_pipe_limit",
  478. .data = &core_pipe_limit,
  479. .maxlen = sizeof(unsigned int),
  480. .mode = 0644,
  481. .proc_handler = proc_dointvec,
  482. },
  483. #endif
  484. #ifdef CONFIG_PROC_SYSCTL
  485. {
  486. .procname = "tainted",
  487. .maxlen = sizeof(long),
  488. .mode = 0644,
  489. .proc_handler = proc_taint,
  490. },
  491. {
  492. .procname = "sysctl_writes_strict",
  493. .data = &sysctl_writes_strict,
  494. .maxlen = sizeof(int),
  495. .mode = 0644,
  496. .proc_handler = proc_dointvec_minmax,
  497. .extra1 = &neg_one,
  498. .extra2 = &one,
  499. },
  500. #endif
  501. #ifdef CONFIG_LATENCYTOP
  502. {
  503. .procname = "latencytop",
  504. .data = &latencytop_enabled,
  505. .maxlen = sizeof(int),
  506. .mode = 0644,
  507. .proc_handler = sysctl_latencytop,
  508. },
  509. #endif
  510. #ifdef CONFIG_BLK_DEV_INITRD
  511. {
  512. .procname = "real-root-dev",
  513. .data = &real_root_dev,
  514. .maxlen = sizeof(int),
  515. .mode = 0644,
  516. .proc_handler = proc_dointvec,
  517. },
  518. #endif
  519. {
  520. .procname = "print-fatal-signals",
  521. .data = &print_fatal_signals,
  522. .maxlen = sizeof(int),
  523. .mode = 0644,
  524. .proc_handler = proc_dointvec,
  525. },
  526. #ifdef CONFIG_SPARC
  527. {
  528. .procname = "reboot-cmd",
  529. .data = reboot_command,
  530. .maxlen = 256,
  531. .mode = 0644,
  532. .proc_handler = proc_dostring,
  533. },
  534. {
  535. .procname = "stop-a",
  536. .data = &stop_a_enabled,
  537. .maxlen = sizeof (int),
  538. .mode = 0644,
  539. .proc_handler = proc_dointvec,
  540. },
  541. {
  542. .procname = "scons-poweroff",
  543. .data = &scons_pwroff,
  544. .maxlen = sizeof (int),
  545. .mode = 0644,
  546. .proc_handler = proc_dointvec,
  547. },
  548. #endif
  549. #ifdef CONFIG_SPARC64
  550. {
  551. .procname = "tsb-ratio",
  552. .data = &sysctl_tsb_ratio,
  553. .maxlen = sizeof (int),
  554. .mode = 0644,
  555. .proc_handler = proc_dointvec,
  556. },
  557. #endif
  558. #ifdef __hppa__
  559. {
  560. .procname = "soft-power",
  561. .data = &pwrsw_enabled,
  562. .maxlen = sizeof (int),
  563. .mode = 0644,
  564. .proc_handler = proc_dointvec,
  565. },
  566. #endif
  567. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  568. {
  569. .procname = "unaligned-trap",
  570. .data = &unaligned_enabled,
  571. .maxlen = sizeof (int),
  572. .mode = 0644,
  573. .proc_handler = proc_dointvec,
  574. },
  575. #endif
  576. {
  577. .procname = "ctrl-alt-del",
  578. .data = &C_A_D,
  579. .maxlen = sizeof(int),
  580. .mode = 0644,
  581. .proc_handler = proc_dointvec,
  582. },
  583. #ifdef CONFIG_FUNCTION_TRACER
  584. {
  585. .procname = "ftrace_enabled",
  586. .data = &ftrace_enabled,
  587. .maxlen = sizeof(int),
  588. .mode = 0644,
  589. .proc_handler = ftrace_enable_sysctl,
  590. },
  591. #endif
  592. #ifdef CONFIG_STACK_TRACER
  593. {
  594. .procname = "stack_tracer_enabled",
  595. .data = &stack_tracer_enabled,
  596. .maxlen = sizeof(int),
  597. .mode = 0644,
  598. .proc_handler = stack_trace_sysctl,
  599. },
  600. #endif
  601. #ifdef CONFIG_TRACING
  602. {
  603. .procname = "ftrace_dump_on_oops",
  604. .data = &ftrace_dump_on_oops,
  605. .maxlen = sizeof(int),
  606. .mode = 0644,
  607. .proc_handler = proc_dointvec,
  608. },
  609. {
  610. .procname = "traceoff_on_warning",
  611. .data = &__disable_trace_on_warning,
  612. .maxlen = sizeof(__disable_trace_on_warning),
  613. .mode = 0644,
  614. .proc_handler = proc_dointvec,
  615. },
  616. {
  617. .procname = "tracepoint_printk",
  618. .data = &tracepoint_printk,
  619. .maxlen = sizeof(tracepoint_printk),
  620. .mode = 0644,
  621. .proc_handler = tracepoint_printk_sysctl,
  622. },
  623. #endif
  624. #ifdef CONFIG_KEXEC_CORE
  625. {
  626. .procname = "kexec_load_disabled",
  627. .data = &kexec_load_disabled,
  628. .maxlen = sizeof(int),
  629. .mode = 0644,
  630. /* only handle a transition from default "0" to "1" */
  631. .proc_handler = proc_dointvec_minmax,
  632. .extra1 = &one,
  633. .extra2 = &one,
  634. },
  635. #endif
  636. #ifdef CONFIG_MODULES
  637. {
  638. .procname = "modprobe",
  639. .data = &modprobe_path,
  640. .maxlen = KMOD_PATH_LEN,
  641. .mode = 0644,
  642. .proc_handler = proc_dostring,
  643. },
  644. {
  645. .procname = "modules_disabled",
  646. .data = &modules_disabled,
  647. .maxlen = sizeof(int),
  648. .mode = 0644,
  649. /* only handle a transition from default "0" to "1" */
  650. .proc_handler = proc_dointvec_minmax,
  651. .extra1 = &one,
  652. .extra2 = &one,
  653. },
  654. #endif
  655. #ifdef CONFIG_UEVENT_HELPER
  656. {
  657. .procname = "hotplug",
  658. .data = &uevent_helper,
  659. .maxlen = UEVENT_HELPER_PATH_LEN,
  660. .mode = 0644,
  661. .proc_handler = proc_dostring,
  662. },
  663. #endif
  664. #ifdef CONFIG_CHR_DEV_SG
  665. {
  666. .procname = "sg-big-buff",
  667. .data = &sg_big_buff,
  668. .maxlen = sizeof (int),
  669. .mode = 0444,
  670. .proc_handler = proc_dointvec,
  671. },
  672. #endif
  673. #ifdef CONFIG_BSD_PROCESS_ACCT
  674. {
  675. .procname = "acct",
  676. .data = &acct_parm,
  677. .maxlen = 3*sizeof(int),
  678. .mode = 0644,
  679. .proc_handler = proc_dointvec,
  680. },
  681. #endif
  682. #ifdef CONFIG_MAGIC_SYSRQ
  683. {
  684. .procname = "sysrq",
  685. .data = &__sysrq_enabled,
  686. .maxlen = sizeof (int),
  687. .mode = 0644,
  688. .proc_handler = sysrq_sysctl_handler,
  689. },
  690. #endif
  691. #ifdef CONFIG_PROC_SYSCTL
  692. {
  693. .procname = "cad_pid",
  694. .data = NULL,
  695. .maxlen = sizeof (int),
  696. .mode = 0600,
  697. .proc_handler = proc_do_cad_pid,
  698. },
  699. #endif
  700. {
  701. .procname = "threads-max",
  702. .data = NULL,
  703. .maxlen = sizeof(int),
  704. .mode = 0644,
  705. .proc_handler = sysctl_max_threads,
  706. },
  707. {
  708. .procname = "random",
  709. .mode = 0555,
  710. .child = random_table,
  711. },
  712. {
  713. .procname = "usermodehelper",
  714. .mode = 0555,
  715. .child = usermodehelper_table,
  716. },
  717. #ifdef CONFIG_FW_LOADER_USER_HELPER
  718. {
  719. .procname = "firmware_config",
  720. .mode = 0555,
  721. .child = firmware_config_table,
  722. },
  723. #endif
  724. {
  725. .procname = "overflowuid",
  726. .data = &overflowuid,
  727. .maxlen = sizeof(int),
  728. .mode = 0644,
  729. .proc_handler = proc_dointvec_minmax,
  730. .extra1 = &minolduid,
  731. .extra2 = &maxolduid,
  732. },
  733. {
  734. .procname = "overflowgid",
  735. .data = &overflowgid,
  736. .maxlen = sizeof(int),
  737. .mode = 0644,
  738. .proc_handler = proc_dointvec_minmax,
  739. .extra1 = &minolduid,
  740. .extra2 = &maxolduid,
  741. },
  742. #ifdef CONFIG_S390
  743. #ifdef CONFIG_MATHEMU
  744. {
  745. .procname = "ieee_emulation_warnings",
  746. .data = &sysctl_ieee_emulation_warnings,
  747. .maxlen = sizeof(int),
  748. .mode = 0644,
  749. .proc_handler = proc_dointvec,
  750. },
  751. #endif
  752. {
  753. .procname = "userprocess_debug",
  754. .data = &show_unhandled_signals,
  755. .maxlen = sizeof(int),
  756. .mode = 0644,
  757. .proc_handler = proc_dointvec,
  758. },
  759. #endif
  760. {
  761. .procname = "pid_max",
  762. .data = &pid_max,
  763. .maxlen = sizeof (int),
  764. .mode = 0644,
  765. .proc_handler = proc_dointvec_minmax,
  766. .extra1 = &pid_max_min,
  767. .extra2 = &pid_max_max,
  768. },
  769. {
  770. .procname = "panic_on_oops",
  771. .data = &panic_on_oops,
  772. .maxlen = sizeof(int),
  773. .mode = 0644,
  774. .proc_handler = proc_dointvec,
  775. },
  776. #if defined CONFIG_PRINTK
  777. {
  778. .procname = "printk",
  779. .data = &console_loglevel,
  780. .maxlen = 4*sizeof(int),
  781. .mode = 0644,
  782. .proc_handler = proc_dointvec,
  783. },
  784. {
  785. .procname = "printk_ratelimit",
  786. .data = &printk_ratelimit_state.interval,
  787. .maxlen = sizeof(int),
  788. .mode = 0644,
  789. .proc_handler = proc_dointvec_jiffies,
  790. },
  791. {
  792. .procname = "printk_ratelimit_burst",
  793. .data = &printk_ratelimit_state.burst,
  794. .maxlen = sizeof(int),
  795. .mode = 0644,
  796. .proc_handler = proc_dointvec,
  797. },
  798. {
  799. .procname = "printk_delay",
  800. .data = &printk_delay_msec,
  801. .maxlen = sizeof(int),
  802. .mode = 0644,
  803. .proc_handler = proc_dointvec_minmax,
  804. .extra1 = &zero,
  805. .extra2 = &ten_thousand,
  806. },
  807. {
  808. .procname = "printk_devkmsg",
  809. .data = devkmsg_log_str,
  810. .maxlen = DEVKMSG_STR_MAX_SIZE,
  811. .mode = 0644,
  812. .proc_handler = devkmsg_sysctl_set_loglvl,
  813. },
  814. {
  815. .procname = "dmesg_restrict",
  816. .data = &dmesg_restrict,
  817. .maxlen = sizeof(int),
  818. .mode = 0644,
  819. .proc_handler = proc_dointvec_minmax_sysadmin,
  820. .extra1 = &zero,
  821. .extra2 = &one,
  822. },
  823. {
  824. .procname = "kptr_restrict",
  825. .data = &kptr_restrict,
  826. .maxlen = sizeof(int),
  827. .mode = 0644,
  828. .proc_handler = proc_dointvec_minmax_sysadmin,
  829. .extra1 = &zero,
  830. .extra2 = &two,
  831. },
  832. #endif
  833. {
  834. .procname = "ngroups_max",
  835. .data = &ngroups_max,
  836. .maxlen = sizeof (int),
  837. .mode = 0444,
  838. .proc_handler = proc_dointvec,
  839. },
  840. {
  841. .procname = "cap_last_cap",
  842. .data = (void *)&cap_last_cap,
  843. .maxlen = sizeof(int),
  844. .mode = 0444,
  845. .proc_handler = proc_dointvec,
  846. },
  847. #if defined(CONFIG_LOCKUP_DETECTOR)
  848. {
  849. .procname = "watchdog",
  850. .data = &watchdog_user_enabled,
  851. .maxlen = sizeof(int),
  852. .mode = 0644,
  853. .proc_handler = proc_watchdog,
  854. .extra1 = &zero,
  855. .extra2 = &one,
  856. },
  857. {
  858. .procname = "watchdog_thresh",
  859. .data = &watchdog_thresh,
  860. .maxlen = sizeof(int),
  861. .mode = 0644,
  862. .proc_handler = proc_watchdog_thresh,
  863. .extra1 = &zero,
  864. .extra2 = &sixty,
  865. },
  866. {
  867. .procname = "nmi_watchdog",
  868. .data = &nmi_watchdog_user_enabled,
  869. .maxlen = sizeof(int),
  870. .mode = NMI_WATCHDOG_SYSCTL_PERM,
  871. .proc_handler = proc_nmi_watchdog,
  872. .extra1 = &zero,
  873. .extra2 = &one,
  874. },
  875. {
  876. .procname = "watchdog_cpumask",
  877. .data = &watchdog_cpumask_bits,
  878. .maxlen = NR_CPUS,
  879. .mode = 0644,
  880. .proc_handler = proc_watchdog_cpumask,
  881. },
  882. #ifdef CONFIG_SOFTLOCKUP_DETECTOR
  883. {
  884. .procname = "soft_watchdog",
  885. .data = &soft_watchdog_user_enabled,
  886. .maxlen = sizeof(int),
  887. .mode = 0644,
  888. .proc_handler = proc_soft_watchdog,
  889. .extra1 = &zero,
  890. .extra2 = &one,
  891. },
  892. {
  893. .procname = "softlockup_panic",
  894. .data = &softlockup_panic,
  895. .maxlen = sizeof(int),
  896. .mode = 0644,
  897. .proc_handler = proc_dointvec_minmax,
  898. .extra1 = &zero,
  899. .extra2 = &one,
  900. },
  901. #ifdef CONFIG_SMP
  902. {
  903. .procname = "softlockup_all_cpu_backtrace",
  904. .data = &sysctl_softlockup_all_cpu_backtrace,
  905. .maxlen = sizeof(int),
  906. .mode = 0644,
  907. .proc_handler = proc_dointvec_minmax,
  908. .extra1 = &zero,
  909. .extra2 = &one,
  910. },
  911. #endif /* CONFIG_SMP */
  912. #endif
  913. #ifdef CONFIG_HARDLOCKUP_DETECTOR
  914. {
  915. .procname = "hardlockup_panic",
  916. .data = &hardlockup_panic,
  917. .maxlen = sizeof(int),
  918. .mode = 0644,
  919. .proc_handler = proc_dointvec_minmax,
  920. .extra1 = &zero,
  921. .extra2 = &one,
  922. },
  923. #ifdef CONFIG_SMP
  924. {
  925. .procname = "hardlockup_all_cpu_backtrace",
  926. .data = &sysctl_hardlockup_all_cpu_backtrace,
  927. .maxlen = sizeof(int),
  928. .mode = 0644,
  929. .proc_handler = proc_dointvec_minmax,
  930. .extra1 = &zero,
  931. .extra2 = &one,
  932. },
  933. #endif /* CONFIG_SMP */
  934. #endif
  935. #endif
  936. #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  937. {
  938. .procname = "unknown_nmi_panic",
  939. .data = &unknown_nmi_panic,
  940. .maxlen = sizeof (int),
  941. .mode = 0644,
  942. .proc_handler = proc_dointvec,
  943. },
  944. #endif
  945. #if defined(CONFIG_X86)
  946. {
  947. .procname = "panic_on_unrecovered_nmi",
  948. .data = &panic_on_unrecovered_nmi,
  949. .maxlen = sizeof(int),
  950. .mode = 0644,
  951. .proc_handler = proc_dointvec,
  952. },
  953. {
  954. .procname = "panic_on_io_nmi",
  955. .data = &panic_on_io_nmi,
  956. .maxlen = sizeof(int),
  957. .mode = 0644,
  958. .proc_handler = proc_dointvec,
  959. },
  960. #ifdef CONFIG_DEBUG_STACKOVERFLOW
  961. {
  962. .procname = "panic_on_stackoverflow",
  963. .data = &sysctl_panic_on_stackoverflow,
  964. .maxlen = sizeof(int),
  965. .mode = 0644,
  966. .proc_handler = proc_dointvec,
  967. },
  968. #endif
  969. {
  970. .procname = "bootloader_type",
  971. .data = &bootloader_type,
  972. .maxlen = sizeof (int),
  973. .mode = 0444,
  974. .proc_handler = proc_dointvec,
  975. },
  976. {
  977. .procname = "bootloader_version",
  978. .data = &bootloader_version,
  979. .maxlen = sizeof (int),
  980. .mode = 0444,
  981. .proc_handler = proc_dointvec,
  982. },
  983. {
  984. .procname = "io_delay_type",
  985. .data = &io_delay_type,
  986. .maxlen = sizeof(int),
  987. .mode = 0644,
  988. .proc_handler = proc_dointvec,
  989. },
  990. #endif
  991. #if defined(CONFIG_MMU)
  992. {
  993. .procname = "randomize_va_space",
  994. .data = &randomize_va_space,
  995. .maxlen = sizeof(int),
  996. .mode = 0644,
  997. .proc_handler = proc_dointvec,
  998. },
  999. #endif
  1000. #if defined(CONFIG_S390) && defined(CONFIG_SMP)
  1001. {
  1002. .procname = "spin_retry",
  1003. .data = &spin_retry,
  1004. .maxlen = sizeof (int),
  1005. .mode = 0644,
  1006. .proc_handler = proc_dointvec,
  1007. },
  1008. #endif
  1009. #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
  1010. {
  1011. .procname = "acpi_video_flags",
  1012. .data = &acpi_realmode_flags,
  1013. .maxlen = sizeof (unsigned long),
  1014. .mode = 0644,
  1015. .proc_handler = proc_doulongvec_minmax,
  1016. },
  1017. #endif
  1018. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  1019. {
  1020. .procname = "ignore-unaligned-usertrap",
  1021. .data = &no_unaligned_warning,
  1022. .maxlen = sizeof (int),
  1023. .mode = 0644,
  1024. .proc_handler = proc_dointvec,
  1025. },
  1026. #endif
  1027. #ifdef CONFIG_IA64
  1028. {
  1029. .procname = "unaligned-dump-stack",
  1030. .data = &unaligned_dump_stack,
  1031. .maxlen = sizeof (int),
  1032. .mode = 0644,
  1033. .proc_handler = proc_dointvec,
  1034. },
  1035. #endif
  1036. #ifdef CONFIG_DETECT_HUNG_TASK
  1037. {
  1038. .procname = "hung_task_panic",
  1039. .data = &sysctl_hung_task_panic,
  1040. .maxlen = sizeof(int),
  1041. .mode = 0644,
  1042. .proc_handler = proc_dointvec_minmax,
  1043. .extra1 = &zero,
  1044. .extra2 = &one,
  1045. },
  1046. {
  1047. .procname = "hung_task_check_count",
  1048. .data = &sysctl_hung_task_check_count,
  1049. .maxlen = sizeof(int),
  1050. .mode = 0644,
  1051. .proc_handler = proc_dointvec_minmax,
  1052. .extra1 = &zero,
  1053. },
  1054. {
  1055. .procname = "hung_task_timeout_secs",
  1056. .data = &sysctl_hung_task_timeout_secs,
  1057. .maxlen = sizeof(unsigned long),
  1058. .mode = 0644,
  1059. .proc_handler = proc_dohung_task_timeout_secs,
  1060. .extra2 = &hung_task_timeout_max,
  1061. },
  1062. {
  1063. .procname = "hung_task_warnings",
  1064. .data = &sysctl_hung_task_warnings,
  1065. .maxlen = sizeof(int),
  1066. .mode = 0644,
  1067. .proc_handler = proc_dointvec_minmax,
  1068. .extra1 = &neg_one,
  1069. },
  1070. #endif
  1071. #ifdef CONFIG_RT_MUTEXES
  1072. {
  1073. .procname = "max_lock_depth",
  1074. .data = &max_lock_depth,
  1075. .maxlen = sizeof(int),
  1076. .mode = 0644,
  1077. .proc_handler = proc_dointvec,
  1078. },
  1079. #endif
  1080. {
  1081. .procname = "poweroff_cmd",
  1082. .data = &poweroff_cmd,
  1083. .maxlen = POWEROFF_CMD_PATH_LEN,
  1084. .mode = 0644,
  1085. .proc_handler = proc_dostring,
  1086. },
  1087. #ifdef CONFIG_KEYS
  1088. {
  1089. .procname = "keys",
  1090. .mode = 0555,
  1091. .child = key_sysctls,
  1092. },
  1093. #endif
  1094. #ifdef CONFIG_PERF_EVENTS
  1095. /*
  1096. * User-space scripts rely on the existence of this file
  1097. * as a feature check for perf_events being enabled.
  1098. *
  1099. * So it's an ABI, do not remove!
  1100. */
  1101. {
  1102. .procname = "perf_event_paranoid",
  1103. .data = &sysctl_perf_event_paranoid,
  1104. .maxlen = sizeof(sysctl_perf_event_paranoid),
  1105. .mode = 0644,
  1106. .proc_handler = proc_dointvec,
  1107. },
  1108. {
  1109. .procname = "perf_event_mlock_kb",
  1110. .data = &sysctl_perf_event_mlock,
  1111. .maxlen = sizeof(sysctl_perf_event_mlock),
  1112. .mode = 0644,
  1113. .proc_handler = proc_dointvec,
  1114. },
  1115. {
  1116. .procname = "perf_event_max_sample_rate",
  1117. .data = &sysctl_perf_event_sample_rate,
  1118. .maxlen = sizeof(sysctl_perf_event_sample_rate),
  1119. .mode = 0644,
  1120. .proc_handler = perf_proc_update_handler,
  1121. .extra1 = &one,
  1122. },
  1123. {
  1124. .procname = "perf_cpu_time_max_percent",
  1125. .data = &sysctl_perf_cpu_time_max_percent,
  1126. .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
  1127. .mode = 0644,
  1128. .proc_handler = perf_cpu_time_max_percent_handler,
  1129. .extra1 = &zero,
  1130. .extra2 = &one_hundred,
  1131. },
  1132. {
  1133. .procname = "perf_event_max_stack",
  1134. .data = &sysctl_perf_event_max_stack,
  1135. .maxlen = sizeof(sysctl_perf_event_max_stack),
  1136. .mode = 0644,
  1137. .proc_handler = perf_event_max_stack_handler,
  1138. .extra1 = &zero,
  1139. .extra2 = &six_hundred_forty_kb,
  1140. },
  1141. {
  1142. .procname = "perf_event_max_contexts_per_stack",
  1143. .data = &sysctl_perf_event_max_contexts_per_stack,
  1144. .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
  1145. .mode = 0644,
  1146. .proc_handler = perf_event_max_stack_handler,
  1147. .extra1 = &zero,
  1148. .extra2 = &one_thousand,
  1149. },
  1150. #endif
  1151. {
  1152. .procname = "panic_on_warn",
  1153. .data = &panic_on_warn,
  1154. .maxlen = sizeof(int),
  1155. .mode = 0644,
  1156. .proc_handler = proc_dointvec_minmax,
  1157. .extra1 = &zero,
  1158. .extra2 = &one,
  1159. },
  1160. #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
  1161. {
  1162. .procname = "timer_migration",
  1163. .data = &sysctl_timer_migration,
  1164. .maxlen = sizeof(unsigned int),
  1165. .mode = 0644,
  1166. .proc_handler = timer_migration_handler,
  1167. .extra1 = &zero,
  1168. .extra2 = &one,
  1169. },
  1170. #endif
  1171. #ifdef CONFIG_BPF_SYSCALL
  1172. {
  1173. .procname = "unprivileged_bpf_disabled",
  1174. .data = &sysctl_unprivileged_bpf_disabled,
  1175. .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
  1176. .mode = 0644,
  1177. /* only handle a transition from default "0" to "1" */
  1178. .proc_handler = proc_dointvec_minmax,
  1179. .extra1 = &one,
  1180. .extra2 = &one,
  1181. },
  1182. #endif
  1183. #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
  1184. {
  1185. .procname = "panic_on_rcu_stall",
  1186. .data = &sysctl_panic_on_rcu_stall,
  1187. .maxlen = sizeof(sysctl_panic_on_rcu_stall),
  1188. .mode = 0644,
  1189. .proc_handler = proc_dointvec_minmax,
  1190. .extra1 = &zero,
  1191. .extra2 = &one,
  1192. },
  1193. #endif
  1194. { }
  1195. };
  1196. static struct ctl_table vm_table[] = {
  1197. {
  1198. .procname = "overcommit_memory",
  1199. .data = &sysctl_overcommit_memory,
  1200. .maxlen = sizeof(sysctl_overcommit_memory),
  1201. .mode = 0644,
  1202. .proc_handler = proc_dointvec_minmax,
  1203. .extra1 = &zero,
  1204. .extra2 = &two,
  1205. },
  1206. {
  1207. .procname = "panic_on_oom",
  1208. .data = &sysctl_panic_on_oom,
  1209. .maxlen = sizeof(sysctl_panic_on_oom),
  1210. .mode = 0644,
  1211. .proc_handler = proc_dointvec_minmax,
  1212. .extra1 = &zero,
  1213. .extra2 = &two,
  1214. },
  1215. {
  1216. .procname = "oom_kill_allocating_task",
  1217. .data = &sysctl_oom_kill_allocating_task,
  1218. .maxlen = sizeof(sysctl_oom_kill_allocating_task),
  1219. .mode = 0644,
  1220. .proc_handler = proc_dointvec,
  1221. },
  1222. {
  1223. .procname = "oom_dump_tasks",
  1224. .data = &sysctl_oom_dump_tasks,
  1225. .maxlen = sizeof(sysctl_oom_dump_tasks),
  1226. .mode = 0644,
  1227. .proc_handler = proc_dointvec,
  1228. },
  1229. {
  1230. .procname = "overcommit_ratio",
  1231. .data = &sysctl_overcommit_ratio,
  1232. .maxlen = sizeof(sysctl_overcommit_ratio),
  1233. .mode = 0644,
  1234. .proc_handler = overcommit_ratio_handler,
  1235. },
  1236. {
  1237. .procname = "overcommit_kbytes",
  1238. .data = &sysctl_overcommit_kbytes,
  1239. .maxlen = sizeof(sysctl_overcommit_kbytes),
  1240. .mode = 0644,
  1241. .proc_handler = overcommit_kbytes_handler,
  1242. },
  1243. {
  1244. .procname = "page-cluster",
  1245. .data = &page_cluster,
  1246. .maxlen = sizeof(int),
  1247. .mode = 0644,
  1248. .proc_handler = proc_dointvec_minmax,
  1249. .extra1 = &zero,
  1250. },
  1251. {
  1252. .procname = "dirty_background_ratio",
  1253. .data = &dirty_background_ratio,
  1254. .maxlen = sizeof(dirty_background_ratio),
  1255. .mode = 0644,
  1256. .proc_handler = dirty_background_ratio_handler,
  1257. .extra1 = &zero,
  1258. .extra2 = &one_hundred,
  1259. },
  1260. {
  1261. .procname = "dirty_background_bytes",
  1262. .data = &dirty_background_bytes,
  1263. .maxlen = sizeof(dirty_background_bytes),
  1264. .mode = 0644,
  1265. .proc_handler = dirty_background_bytes_handler,
  1266. .extra1 = &one_ul,
  1267. },
  1268. {
  1269. .procname = "dirty_ratio",
  1270. .data = &vm_dirty_ratio,
  1271. .maxlen = sizeof(vm_dirty_ratio),
  1272. .mode = 0644,
  1273. .proc_handler = dirty_ratio_handler,
  1274. .extra1 = &zero,
  1275. .extra2 = &one_hundred,
  1276. },
  1277. {
  1278. .procname = "dirty_bytes",
  1279. .data = &vm_dirty_bytes,
  1280. .maxlen = sizeof(vm_dirty_bytes),
  1281. .mode = 0644,
  1282. .proc_handler = dirty_bytes_handler,
  1283. .extra1 = &dirty_bytes_min,
  1284. },
  1285. {
  1286. .procname = "dirty_writeback_centisecs",
  1287. .data = &dirty_writeback_interval,
  1288. .maxlen = sizeof(dirty_writeback_interval),
  1289. .mode = 0644,
  1290. .proc_handler = dirty_writeback_centisecs_handler,
  1291. },
  1292. {
  1293. .procname = "dirty_expire_centisecs",
  1294. .data = &dirty_expire_interval,
  1295. .maxlen = sizeof(dirty_expire_interval),
  1296. .mode = 0644,
  1297. .proc_handler = proc_dointvec_minmax,
  1298. .extra1 = &zero,
  1299. },
  1300. {
  1301. .procname = "dirtytime_expire_seconds",
  1302. .data = &dirtytime_expire_interval,
  1303. .maxlen = sizeof(dirtytime_expire_interval),
  1304. .mode = 0644,
  1305. .proc_handler = dirtytime_interval_handler,
  1306. .extra1 = &zero,
  1307. },
  1308. {
  1309. .procname = "swappiness",
  1310. .data = &vm_swappiness,
  1311. .maxlen = sizeof(vm_swappiness),
  1312. .mode = 0644,
  1313. .proc_handler = proc_dointvec_minmax,
  1314. .extra1 = &zero,
  1315. .extra2 = &one_hundred,
  1316. },
  1317. #ifdef CONFIG_HUGETLB_PAGE
  1318. {
  1319. .procname = "nr_hugepages",
  1320. .data = NULL,
  1321. .maxlen = sizeof(unsigned long),
  1322. .mode = 0644,
  1323. .proc_handler = hugetlb_sysctl_handler,
  1324. },
  1325. #ifdef CONFIG_NUMA
  1326. {
  1327. .procname = "nr_hugepages_mempolicy",
  1328. .data = NULL,
  1329. .maxlen = sizeof(unsigned long),
  1330. .mode = 0644,
  1331. .proc_handler = &hugetlb_mempolicy_sysctl_handler,
  1332. },
  1333. {
  1334. .procname = "numa_stat",
  1335. .data = &sysctl_vm_numa_stat,
  1336. .maxlen = sizeof(int),
  1337. .mode = 0644,
  1338. .proc_handler = sysctl_vm_numa_stat_handler,
  1339. .extra1 = &zero,
  1340. .extra2 = &one,
  1341. },
  1342. #endif
  1343. {
  1344. .procname = "hugetlb_shm_group",
  1345. .data = &sysctl_hugetlb_shm_group,
  1346. .maxlen = sizeof(gid_t),
  1347. .mode = 0644,
  1348. .proc_handler = proc_dointvec,
  1349. },
  1350. {
  1351. .procname = "nr_overcommit_hugepages",
  1352. .data = NULL,
  1353. .maxlen = sizeof(unsigned long),
  1354. .mode = 0644,
  1355. .proc_handler = hugetlb_overcommit_handler,
  1356. },
  1357. #endif
  1358. {
  1359. .procname = "lowmem_reserve_ratio",
  1360. .data = &sysctl_lowmem_reserve_ratio,
  1361. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  1362. .mode = 0644,
  1363. .proc_handler = lowmem_reserve_ratio_sysctl_handler,
  1364. },
  1365. {
  1366. .procname = "drop_caches",
  1367. .data = &sysctl_drop_caches,
  1368. .maxlen = sizeof(int),
  1369. .mode = 0644,
  1370. .proc_handler = drop_caches_sysctl_handler,
  1371. .extra1 = &one,
  1372. .extra2 = &four,
  1373. },
  1374. #ifdef CONFIG_COMPACTION
  1375. {
  1376. .procname = "compact_memory",
  1377. .data = &sysctl_compact_memory,
  1378. .maxlen = sizeof(int),
  1379. .mode = 0200,
  1380. .proc_handler = sysctl_compaction_handler,
  1381. },
  1382. {
  1383. .procname = "extfrag_threshold",
  1384. .data = &sysctl_extfrag_threshold,
  1385. .maxlen = sizeof(int),
  1386. .mode = 0644,
  1387. .proc_handler = sysctl_extfrag_handler,
  1388. .extra1 = &min_extfrag_threshold,
  1389. .extra2 = &max_extfrag_threshold,
  1390. },
  1391. {
  1392. .procname = "compact_unevictable_allowed",
  1393. .data = &sysctl_compact_unevictable_allowed,
  1394. .maxlen = sizeof(int),
  1395. .mode = 0644,
  1396. .proc_handler = proc_dointvec,
  1397. .extra1 = &zero,
  1398. .extra2 = &one,
  1399. },
  1400. #endif /* CONFIG_COMPACTION */
  1401. {
  1402. .procname = "min_free_kbytes",
  1403. .data = &min_free_kbytes,
  1404. .maxlen = sizeof(min_free_kbytes),
  1405. .mode = 0644,
  1406. .proc_handler = min_free_kbytes_sysctl_handler,
  1407. .extra1 = &zero,
  1408. },
  1409. {
  1410. .procname = "watermark_scale_factor",
  1411. .data = &watermark_scale_factor,
  1412. .maxlen = sizeof(watermark_scale_factor),
  1413. .mode = 0644,
  1414. .proc_handler = watermark_scale_factor_sysctl_handler,
  1415. .extra1 = &one,
  1416. .extra2 = &one_thousand,
  1417. },
  1418. {
  1419. .procname = "percpu_pagelist_fraction",
  1420. .data = &percpu_pagelist_fraction,
  1421. .maxlen = sizeof(percpu_pagelist_fraction),
  1422. .mode = 0644,
  1423. .proc_handler = percpu_pagelist_fraction_sysctl_handler,
  1424. .extra1 = &zero,
  1425. },
  1426. #ifdef CONFIG_MMU
  1427. {
  1428. .procname = "max_map_count",
  1429. .data = &sysctl_max_map_count,
  1430. .maxlen = sizeof(sysctl_max_map_count),
  1431. .mode = 0644,
  1432. .proc_handler = proc_dointvec_minmax,
  1433. .extra1 = &zero,
  1434. },
  1435. #else
  1436. {
  1437. .procname = "nr_trim_pages",
  1438. .data = &sysctl_nr_trim_pages,
  1439. .maxlen = sizeof(sysctl_nr_trim_pages),
  1440. .mode = 0644,
  1441. .proc_handler = proc_dointvec_minmax,
  1442. .extra1 = &zero,
  1443. },
  1444. #endif
  1445. {
  1446. .procname = "laptop_mode",
  1447. .data = &laptop_mode,
  1448. .maxlen = sizeof(laptop_mode),
  1449. .mode = 0644,
  1450. .proc_handler = proc_dointvec_jiffies,
  1451. },
  1452. {
  1453. .procname = "block_dump",
  1454. .data = &block_dump,
  1455. .maxlen = sizeof(block_dump),
  1456. .mode = 0644,
  1457. .proc_handler = proc_dointvec,
  1458. .extra1 = &zero,
  1459. },
  1460. {
  1461. .procname = "vfs_cache_pressure",
  1462. .data = &sysctl_vfs_cache_pressure,
  1463. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  1464. .mode = 0644,
  1465. .proc_handler = proc_dointvec,
  1466. .extra1 = &zero,
  1467. },
  1468. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  1469. {
  1470. .procname = "legacy_va_layout",
  1471. .data = &sysctl_legacy_va_layout,
  1472. .maxlen = sizeof(sysctl_legacy_va_layout),
  1473. .mode = 0644,
  1474. .proc_handler = proc_dointvec,
  1475. .extra1 = &zero,
  1476. },
  1477. #endif
  1478. #ifdef CONFIG_NUMA
  1479. {
  1480. .procname = "zone_reclaim_mode",
  1481. .data = &node_reclaim_mode,
  1482. .maxlen = sizeof(node_reclaim_mode),
  1483. .mode = 0644,
  1484. .proc_handler = proc_dointvec,
  1485. .extra1 = &zero,
  1486. },
  1487. {
  1488. .procname = "min_unmapped_ratio",
  1489. .data = &sysctl_min_unmapped_ratio,
  1490. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  1491. .mode = 0644,
  1492. .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
  1493. .extra1 = &zero,
  1494. .extra2 = &one_hundred,
  1495. },
  1496. {
  1497. .procname = "min_slab_ratio",
  1498. .data = &sysctl_min_slab_ratio,
  1499. .maxlen = sizeof(sysctl_min_slab_ratio),
  1500. .mode = 0644,
  1501. .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
  1502. .extra1 = &zero,
  1503. .extra2 = &one_hundred,
  1504. },
  1505. #endif
  1506. #ifdef CONFIG_SMP
  1507. {
  1508. .procname = "stat_interval",
  1509. .data = &sysctl_stat_interval,
  1510. .maxlen = sizeof(sysctl_stat_interval),
  1511. .mode = 0644,
  1512. .proc_handler = proc_dointvec_jiffies,
  1513. },
  1514. {
  1515. .procname = "stat_refresh",
  1516. .data = NULL,
  1517. .maxlen = 0,
  1518. .mode = 0600,
  1519. .proc_handler = vmstat_refresh,
  1520. },
  1521. #endif
  1522. #ifdef CONFIG_MMU
  1523. {
  1524. .procname = "mmap_min_addr",
  1525. .data = &dac_mmap_min_addr,
  1526. .maxlen = sizeof(unsigned long),
  1527. .mode = 0644,
  1528. .proc_handler = mmap_min_addr_handler,
  1529. },
  1530. #endif
  1531. #ifdef CONFIG_NUMA
  1532. {
  1533. .procname = "numa_zonelist_order",
  1534. .data = &numa_zonelist_order,
  1535. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  1536. .mode = 0644,
  1537. .proc_handler = numa_zonelist_order_handler,
  1538. },
  1539. #endif
  1540. #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
  1541. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  1542. {
  1543. .procname = "vdso_enabled",
  1544. #ifdef CONFIG_X86_32
  1545. .data = &vdso32_enabled,
  1546. .maxlen = sizeof(vdso32_enabled),
  1547. #else
  1548. .data = &vdso_enabled,
  1549. .maxlen = sizeof(vdso_enabled),
  1550. #endif
  1551. .mode = 0644,
  1552. .proc_handler = proc_dointvec,
  1553. .extra1 = &zero,
  1554. },
  1555. #endif
  1556. #ifdef CONFIG_HIGHMEM
  1557. {
  1558. .procname = "highmem_is_dirtyable",
  1559. .data = &vm_highmem_is_dirtyable,
  1560. .maxlen = sizeof(vm_highmem_is_dirtyable),
  1561. .mode = 0644,
  1562. .proc_handler = proc_dointvec_minmax,
  1563. .extra1 = &zero,
  1564. .extra2 = &one,
  1565. },
  1566. #endif
  1567. #ifdef CONFIG_MEMORY_FAILURE
  1568. {
  1569. .procname = "memory_failure_early_kill",
  1570. .data = &sysctl_memory_failure_early_kill,
  1571. .maxlen = sizeof(sysctl_memory_failure_early_kill),
  1572. .mode = 0644,
  1573. .proc_handler = proc_dointvec_minmax,
  1574. .extra1 = &zero,
  1575. .extra2 = &one,
  1576. },
  1577. {
  1578. .procname = "memory_failure_recovery",
  1579. .data = &sysctl_memory_failure_recovery,
  1580. .maxlen = sizeof(sysctl_memory_failure_recovery),
  1581. .mode = 0644,
  1582. .proc_handler = proc_dointvec_minmax,
  1583. .extra1 = &zero,
  1584. .extra2 = &one,
  1585. },
  1586. #endif
  1587. {
  1588. .procname = "user_reserve_kbytes",
  1589. .data = &sysctl_user_reserve_kbytes,
  1590. .maxlen = sizeof(sysctl_user_reserve_kbytes),
  1591. .mode = 0644,
  1592. .proc_handler = proc_doulongvec_minmax,
  1593. },
  1594. {
  1595. .procname = "admin_reserve_kbytes",
  1596. .data = &sysctl_admin_reserve_kbytes,
  1597. .maxlen = sizeof(sysctl_admin_reserve_kbytes),
  1598. .mode = 0644,
  1599. .proc_handler = proc_doulongvec_minmax,
  1600. },
  1601. #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
  1602. {
  1603. .procname = "mmap_rnd_bits",
  1604. .data = &mmap_rnd_bits,
  1605. .maxlen = sizeof(mmap_rnd_bits),
  1606. .mode = 0600,
  1607. .proc_handler = proc_dointvec_minmax,
  1608. .extra1 = (void *)&mmap_rnd_bits_min,
  1609. .extra2 = (void *)&mmap_rnd_bits_max,
  1610. },
  1611. #endif
  1612. #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
  1613. {
  1614. .procname = "mmap_rnd_compat_bits",
  1615. .data = &mmap_rnd_compat_bits,
  1616. .maxlen = sizeof(mmap_rnd_compat_bits),
  1617. .mode = 0600,
  1618. .proc_handler = proc_dointvec_minmax,
  1619. .extra1 = (void *)&mmap_rnd_compat_bits_min,
  1620. .extra2 = (void *)&mmap_rnd_compat_bits_max,
  1621. },
  1622. #endif
  1623. { }
  1624. };
  1625. static struct ctl_table fs_table[] = {
  1626. {
  1627. .procname = "inode-nr",
  1628. .data = &inodes_stat,
  1629. .maxlen = 2*sizeof(long),
  1630. .mode = 0444,
  1631. .proc_handler = proc_nr_inodes,
  1632. },
  1633. {
  1634. .procname = "inode-state",
  1635. .data = &inodes_stat,
  1636. .maxlen = 7*sizeof(long),
  1637. .mode = 0444,
  1638. .proc_handler = proc_nr_inodes,
  1639. },
  1640. {
  1641. .procname = "file-nr",
  1642. .data = &files_stat,
  1643. .maxlen = sizeof(files_stat),
  1644. .mode = 0444,
  1645. .proc_handler = proc_nr_files,
  1646. },
  1647. {
  1648. .procname = "file-max",
  1649. .data = &files_stat.max_files,
  1650. .maxlen = sizeof(files_stat.max_files),
  1651. .mode = 0644,
  1652. .proc_handler = proc_doulongvec_minmax,
  1653. },
  1654. {
  1655. .procname = "nr_open",
  1656. .data = &sysctl_nr_open,
  1657. .maxlen = sizeof(unsigned int),
  1658. .mode = 0644,
  1659. .proc_handler = proc_dointvec_minmax,
  1660. .extra1 = &sysctl_nr_open_min,
  1661. .extra2 = &sysctl_nr_open_max,
  1662. },
  1663. {
  1664. .procname = "dentry-state",
  1665. .data = &dentry_stat,
  1666. .maxlen = 6*sizeof(long),
  1667. .mode = 0444,
  1668. .proc_handler = proc_nr_dentry,
  1669. },
  1670. {
  1671. .procname = "overflowuid",
  1672. .data = &fs_overflowuid,
  1673. .maxlen = sizeof(int),
  1674. .mode = 0644,
  1675. .proc_handler = proc_dointvec_minmax,
  1676. .extra1 = &minolduid,
  1677. .extra2 = &maxolduid,
  1678. },
  1679. {
  1680. .procname = "overflowgid",
  1681. .data = &fs_overflowgid,
  1682. .maxlen = sizeof(int),
  1683. .mode = 0644,
  1684. .proc_handler = proc_dointvec_minmax,
  1685. .extra1 = &minolduid,
  1686. .extra2 = &maxolduid,
  1687. },
  1688. #ifdef CONFIG_FILE_LOCKING
  1689. {
  1690. .procname = "leases-enable",
  1691. .data = &leases_enable,
  1692. .maxlen = sizeof(int),
  1693. .mode = 0644,
  1694. .proc_handler = proc_dointvec,
  1695. },
  1696. #endif
  1697. #ifdef CONFIG_DNOTIFY
  1698. {
  1699. .procname = "dir-notify-enable",
  1700. .data = &dir_notify_enable,
  1701. .maxlen = sizeof(int),
  1702. .mode = 0644,
  1703. .proc_handler = proc_dointvec,
  1704. },
  1705. #endif
  1706. #ifdef CONFIG_MMU
  1707. #ifdef CONFIG_FILE_LOCKING
  1708. {
  1709. .procname = "lease-break-time",
  1710. .data = &lease_break_time,
  1711. .maxlen = sizeof(int),
  1712. .mode = 0644,
  1713. .proc_handler = proc_dointvec,
  1714. },
  1715. #endif
  1716. #ifdef CONFIG_AIO
  1717. {
  1718. .procname = "aio-nr",
  1719. .data = &aio_nr,
  1720. .maxlen = sizeof(aio_nr),
  1721. .mode = 0444,
  1722. .proc_handler = proc_doulongvec_minmax,
  1723. },
  1724. {
  1725. .procname = "aio-max-nr",
  1726. .data = &aio_max_nr,
  1727. .maxlen = sizeof(aio_max_nr),
  1728. .mode = 0644,
  1729. .proc_handler = proc_doulongvec_minmax,
  1730. },
  1731. #endif /* CONFIG_AIO */
  1732. #ifdef CONFIG_INOTIFY_USER
  1733. {
  1734. .procname = "inotify",
  1735. .mode = 0555,
  1736. .child = inotify_table,
  1737. },
  1738. #endif
  1739. #ifdef CONFIG_EPOLL
  1740. {
  1741. .procname = "epoll",
  1742. .mode = 0555,
  1743. .child = epoll_table,
  1744. },
  1745. #endif
  1746. #endif
  1747. {
  1748. .procname = "protected_symlinks",
  1749. .data = &sysctl_protected_symlinks,
  1750. .maxlen = sizeof(int),
  1751. .mode = 0600,
  1752. .proc_handler = proc_dointvec_minmax,
  1753. .extra1 = &zero,
  1754. .extra2 = &one,
  1755. },
  1756. {
  1757. .procname = "protected_hardlinks",
  1758. .data = &sysctl_protected_hardlinks,
  1759. .maxlen = sizeof(int),
  1760. .mode = 0600,
  1761. .proc_handler = proc_dointvec_minmax,
  1762. .extra1 = &zero,
  1763. .extra2 = &one,
  1764. },
  1765. {
  1766. .procname = "suid_dumpable",
  1767. .data = &suid_dumpable,
  1768. .maxlen = sizeof(int),
  1769. .mode = 0644,
  1770. .proc_handler = proc_dointvec_minmax_coredump,
  1771. .extra1 = &zero,
  1772. .extra2 = &two,
  1773. },
  1774. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1775. {
  1776. .procname = "binfmt_misc",
  1777. .mode = 0555,
  1778. .child = sysctl_mount_point,
  1779. },
  1780. #endif
  1781. {
  1782. .procname = "pipe-max-size",
  1783. .data = &pipe_max_size,
  1784. .maxlen = sizeof(pipe_max_size),
  1785. .mode = 0644,
  1786. .proc_handler = proc_dopipe_max_size,
  1787. },
  1788. {
  1789. .procname = "pipe-user-pages-hard",
  1790. .data = &pipe_user_pages_hard,
  1791. .maxlen = sizeof(pipe_user_pages_hard),
  1792. .mode = 0644,
  1793. .proc_handler = proc_doulongvec_minmax,
  1794. },
  1795. {
  1796. .procname = "pipe-user-pages-soft",
  1797. .data = &pipe_user_pages_soft,
  1798. .maxlen = sizeof(pipe_user_pages_soft),
  1799. .mode = 0644,
  1800. .proc_handler = proc_doulongvec_minmax,
  1801. },
  1802. {
  1803. .procname = "mount-max",
  1804. .data = &sysctl_mount_max,
  1805. .maxlen = sizeof(unsigned int),
  1806. .mode = 0644,
  1807. .proc_handler = proc_dointvec_minmax,
  1808. .extra1 = &one,
  1809. },
  1810. { }
  1811. };
  1812. static struct ctl_table debug_table[] = {
  1813. #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
  1814. {
  1815. .procname = "exception-trace",
  1816. .data = &show_unhandled_signals,
  1817. .maxlen = sizeof(int),
  1818. .mode = 0644,
  1819. .proc_handler = proc_dointvec
  1820. },
  1821. #endif
  1822. #if defined(CONFIG_OPTPROBES)
  1823. {
  1824. .procname = "kprobes-optimization",
  1825. .data = &sysctl_kprobes_optimization,
  1826. .maxlen = sizeof(int),
  1827. .mode = 0644,
  1828. .proc_handler = proc_kprobes_optimization_handler,
  1829. .extra1 = &zero,
  1830. .extra2 = &one,
  1831. },
  1832. #endif
  1833. { }
  1834. };
  1835. static struct ctl_table dev_table[] = {
  1836. { }
  1837. };
  1838. int __init sysctl_init(void)
  1839. {
  1840. struct ctl_table_header *hdr;
  1841. hdr = register_sysctl_table(sysctl_base_table);
  1842. kmemleak_not_leak(hdr);
  1843. return 0;
  1844. }
  1845. #endif /* CONFIG_SYSCTL */
  1846. /*
  1847. * /proc/sys support
  1848. */
  1849. #ifdef CONFIG_PROC_SYSCTL
  1850. static int _proc_do_string(char *data, int maxlen, int write,
  1851. char __user *buffer,
  1852. size_t *lenp, loff_t *ppos)
  1853. {
  1854. size_t len;
  1855. char __user *p;
  1856. char c;
  1857. if (!data || !maxlen || !*lenp) {
  1858. *lenp = 0;
  1859. return 0;
  1860. }
  1861. if (write) {
  1862. if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
  1863. /* Only continue writes not past the end of buffer. */
  1864. len = strlen(data);
  1865. if (len > maxlen - 1)
  1866. len = maxlen - 1;
  1867. if (*ppos > len)
  1868. return 0;
  1869. len = *ppos;
  1870. } else {
  1871. /* Start writing from beginning of buffer. */
  1872. len = 0;
  1873. }
  1874. *ppos += *lenp;
  1875. p = buffer;
  1876. while ((p - buffer) < *lenp && len < maxlen - 1) {
  1877. if (get_user(c, p++))
  1878. return -EFAULT;
  1879. if (c == 0 || c == '\n')
  1880. break;
  1881. data[len++] = c;
  1882. }
  1883. data[len] = 0;
  1884. } else {
  1885. len = strlen(data);
  1886. if (len > maxlen)
  1887. len = maxlen;
  1888. if (*ppos > len) {
  1889. *lenp = 0;
  1890. return 0;
  1891. }
  1892. data += *ppos;
  1893. len -= *ppos;
  1894. if (len > *lenp)
  1895. len = *lenp;
  1896. if (len)
  1897. if (copy_to_user(buffer, data, len))
  1898. return -EFAULT;
  1899. if (len < *lenp) {
  1900. if (put_user('\n', buffer + len))
  1901. return -EFAULT;
  1902. len++;
  1903. }
  1904. *lenp = len;
  1905. *ppos += len;
  1906. }
  1907. return 0;
  1908. }
  1909. static void warn_sysctl_write(struct ctl_table *table)
  1910. {
  1911. pr_warn_once("%s wrote to %s when file position was not 0!\n"
  1912. "This will not be supported in the future. To silence this\n"
  1913. "warning, set kernel.sysctl_writes_strict = -1\n",
  1914. current->comm, table->procname);
  1915. }
  1916. /**
  1917. * proc_first_pos_non_zero_ignore - check if firs position is allowed
  1918. * @ppos: file position
  1919. * @table: the sysctl table
  1920. *
  1921. * Returns true if the first position is non-zero and the sysctl_writes_strict
  1922. * mode indicates this is not allowed for numeric input types. String proc
  1923. * hadlers can ignore the return value.
  1924. */
  1925. static bool proc_first_pos_non_zero_ignore(loff_t *ppos,
  1926. struct ctl_table *table)
  1927. {
  1928. if (!*ppos)
  1929. return false;
  1930. switch (sysctl_writes_strict) {
  1931. case SYSCTL_WRITES_STRICT:
  1932. return true;
  1933. case SYSCTL_WRITES_WARN:
  1934. warn_sysctl_write(table);
  1935. return false;
  1936. default:
  1937. return false;
  1938. }
  1939. }
  1940. /**
  1941. * proc_dostring - read a string sysctl
  1942. * @table: the sysctl table
  1943. * @write: %TRUE if this is a write to the sysctl file
  1944. * @buffer: the user buffer
  1945. * @lenp: the size of the user buffer
  1946. * @ppos: file position
  1947. *
  1948. * Reads/writes a string from/to the user buffer. If the kernel
  1949. * buffer provided is not large enough to hold the string, the
  1950. * string is truncated. The copied string is %NULL-terminated.
  1951. * If the string is being read by the user process, it is copied
  1952. * and a newline '\n' is added. It is truncated if the buffer is
  1953. * not large enough.
  1954. *
  1955. * Returns 0 on success.
  1956. */
  1957. int proc_dostring(struct ctl_table *table, int write,
  1958. void __user *buffer, size_t *lenp, loff_t *ppos)
  1959. {
  1960. if (write)
  1961. proc_first_pos_non_zero_ignore(ppos, table);
  1962. return _proc_do_string((char *)(table->data), table->maxlen, write,
  1963. (char __user *)buffer, lenp, ppos);
  1964. }
  1965. static size_t proc_skip_spaces(char **buf)
  1966. {
  1967. size_t ret;
  1968. char *tmp = skip_spaces(*buf);
  1969. ret = tmp - *buf;
  1970. *buf = tmp;
  1971. return ret;
  1972. }
  1973. static void proc_skip_char(char **buf, size_t *size, const char v)
  1974. {
  1975. while (*size) {
  1976. if (**buf != v)
  1977. break;
  1978. (*size)--;
  1979. (*buf)++;
  1980. }
  1981. }
  1982. #define TMPBUFLEN 22
  1983. /**
  1984. * proc_get_long - reads an ASCII formatted integer from a user buffer
  1985. *
  1986. * @buf: a kernel buffer
  1987. * @size: size of the kernel buffer
  1988. * @val: this is where the number will be stored
  1989. * @neg: set to %TRUE if number is negative
  1990. * @perm_tr: a vector which contains the allowed trailers
  1991. * @perm_tr_len: size of the perm_tr vector
  1992. * @tr: pointer to store the trailer character
  1993. *
  1994. * In case of success %0 is returned and @buf and @size are updated with
  1995. * the amount of bytes read. If @tr is non-NULL and a trailing
  1996. * character exists (size is non-zero after returning from this
  1997. * function), @tr is updated with the trailing character.
  1998. */
  1999. static int proc_get_long(char **buf, size_t *size,
  2000. unsigned long *val, bool *neg,
  2001. const char *perm_tr, unsigned perm_tr_len, char *tr)
  2002. {
  2003. int len;
  2004. char *p, tmp[TMPBUFLEN];
  2005. if (!*size)
  2006. return -EINVAL;
  2007. len = *size;
  2008. if (len > TMPBUFLEN - 1)
  2009. len = TMPBUFLEN - 1;
  2010. memcpy(tmp, *buf, len);
  2011. tmp[len] = 0;
  2012. p = tmp;
  2013. if (*p == '-' && *size > 1) {
  2014. *neg = true;
  2015. p++;
  2016. } else
  2017. *neg = false;
  2018. if (!isdigit(*p))
  2019. return -EINVAL;
  2020. *val = simple_strtoul(p, &p, 0);
  2021. len = p - tmp;
  2022. /* We don't know if the next char is whitespace thus we may accept
  2023. * invalid integers (e.g. 1234...a) or two integers instead of one
  2024. * (e.g. 123...1). So lets not allow such large numbers. */
  2025. if (len == TMPBUFLEN - 1)
  2026. return -EINVAL;
  2027. if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
  2028. return -EINVAL;
  2029. if (tr && (len < *size))
  2030. *tr = *p;
  2031. *buf += len;
  2032. *size -= len;
  2033. return 0;
  2034. }
  2035. /**
  2036. * proc_put_long - converts an integer to a decimal ASCII formatted string
  2037. *
  2038. * @buf: the user buffer
  2039. * @size: the size of the user buffer
  2040. * @val: the integer to be converted
  2041. * @neg: sign of the number, %TRUE for negative
  2042. *
  2043. * In case of success %0 is returned and @buf and @size are updated with
  2044. * the amount of bytes written.
  2045. */
  2046. static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
  2047. bool neg)
  2048. {
  2049. int len;
  2050. char tmp[TMPBUFLEN], *p = tmp;
  2051. sprintf(p, "%s%lu", neg ? "-" : "", val);
  2052. len = strlen(tmp);
  2053. if (len > *size)
  2054. len = *size;
  2055. if (copy_to_user(*buf, tmp, len))
  2056. return -EFAULT;
  2057. *size -= len;
  2058. *buf += len;
  2059. return 0;
  2060. }
  2061. #undef TMPBUFLEN
  2062. static int proc_put_char(void __user **buf, size_t *size, char c)
  2063. {
  2064. if (*size) {
  2065. char __user **buffer = (char __user **)buf;
  2066. if (put_user(c, *buffer))
  2067. return -EFAULT;
  2068. (*size)--, (*buffer)++;
  2069. *buf = *buffer;
  2070. }
  2071. return 0;
  2072. }
  2073. static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
  2074. int *valp,
  2075. int write, void *data)
  2076. {
  2077. if (write) {
  2078. if (*negp) {
  2079. if (*lvalp > (unsigned long) INT_MAX + 1)
  2080. return -EINVAL;
  2081. *valp = -*lvalp;
  2082. } else {
  2083. if (*lvalp > (unsigned long) INT_MAX)
  2084. return -EINVAL;
  2085. *valp = *lvalp;
  2086. }
  2087. } else {
  2088. int val = *valp;
  2089. if (val < 0) {
  2090. *negp = true;
  2091. *lvalp = -(unsigned long)val;
  2092. } else {
  2093. *negp = false;
  2094. *lvalp = (unsigned long)val;
  2095. }
  2096. }
  2097. return 0;
  2098. }
  2099. static int do_proc_douintvec_conv(unsigned long *lvalp,
  2100. unsigned int *valp,
  2101. int write, void *data)
  2102. {
  2103. if (write) {
  2104. if (*lvalp > UINT_MAX)
  2105. return -EINVAL;
  2106. *valp = *lvalp;
  2107. } else {
  2108. unsigned int val = *valp;
  2109. *lvalp = (unsigned long)val;
  2110. }
  2111. return 0;
  2112. }
  2113. static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
  2114. static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
  2115. int write, void __user *buffer,
  2116. size_t *lenp, loff_t *ppos,
  2117. int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
  2118. int write, void *data),
  2119. void *data)
  2120. {
  2121. int *i, vleft, first = 1, err = 0;
  2122. size_t left;
  2123. char *kbuf = NULL, *p;
  2124. if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2125. *lenp = 0;
  2126. return 0;
  2127. }
  2128. i = (int *) tbl_data;
  2129. vleft = table->maxlen / sizeof(*i);
  2130. left = *lenp;
  2131. if (!conv)
  2132. conv = do_proc_dointvec_conv;
  2133. if (write) {
  2134. if (proc_first_pos_non_zero_ignore(ppos, table))
  2135. goto out;
  2136. if (left > PAGE_SIZE - 1)
  2137. left = PAGE_SIZE - 1;
  2138. p = kbuf = memdup_user_nul(buffer, left);
  2139. if (IS_ERR(kbuf))
  2140. return PTR_ERR(kbuf);
  2141. }
  2142. for (; left && vleft--; i++, first=0) {
  2143. unsigned long lval;
  2144. bool neg;
  2145. if (write) {
  2146. left -= proc_skip_spaces(&p);
  2147. if (!left)
  2148. break;
  2149. err = proc_get_long(&p, &left, &lval, &neg,
  2150. proc_wspace_sep,
  2151. sizeof(proc_wspace_sep), NULL);
  2152. if (err)
  2153. break;
  2154. if (conv(&neg, &lval, i, 1, data)) {
  2155. err = -EINVAL;
  2156. break;
  2157. }
  2158. } else {
  2159. if (conv(&neg, &lval, i, 0, data)) {
  2160. err = -EINVAL;
  2161. break;
  2162. }
  2163. if (!first)
  2164. err = proc_put_char(&buffer, &left, '\t');
  2165. if (err)
  2166. break;
  2167. err = proc_put_long(&buffer, &left, lval, neg);
  2168. if (err)
  2169. break;
  2170. }
  2171. }
  2172. if (!write && !first && left && !err)
  2173. err = proc_put_char(&buffer, &left, '\n');
  2174. if (write && !err && left)
  2175. left -= proc_skip_spaces(&p);
  2176. if (write) {
  2177. kfree(kbuf);
  2178. if (first)
  2179. return err ? : -EINVAL;
  2180. }
  2181. *lenp -= left;
  2182. out:
  2183. *ppos += *lenp;
  2184. return err;
  2185. }
  2186. static int do_proc_dointvec(struct ctl_table *table, int write,
  2187. void __user *buffer, size_t *lenp, loff_t *ppos,
  2188. int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
  2189. int write, void *data),
  2190. void *data)
  2191. {
  2192. return __do_proc_dointvec(table->data, table, write,
  2193. buffer, lenp, ppos, conv, data);
  2194. }
  2195. static int do_proc_douintvec_w(unsigned int *tbl_data,
  2196. struct ctl_table *table,
  2197. void __user *buffer,
  2198. size_t *lenp, loff_t *ppos,
  2199. int (*conv)(unsigned long *lvalp,
  2200. unsigned int *valp,
  2201. int write, void *data),
  2202. void *data)
  2203. {
  2204. unsigned long lval;
  2205. int err = 0;
  2206. size_t left;
  2207. bool neg;
  2208. char *kbuf = NULL, *p;
  2209. left = *lenp;
  2210. if (proc_first_pos_non_zero_ignore(ppos, table))
  2211. goto bail_early;
  2212. if (left > PAGE_SIZE - 1)
  2213. left = PAGE_SIZE - 1;
  2214. p = kbuf = memdup_user_nul(buffer, left);
  2215. if (IS_ERR(kbuf))
  2216. return -EINVAL;
  2217. left -= proc_skip_spaces(&p);
  2218. if (!left) {
  2219. err = -EINVAL;
  2220. goto out_free;
  2221. }
  2222. err = proc_get_long(&p, &left, &lval, &neg,
  2223. proc_wspace_sep,
  2224. sizeof(proc_wspace_sep), NULL);
  2225. if (err || neg) {
  2226. err = -EINVAL;
  2227. goto out_free;
  2228. }
  2229. if (conv(&lval, tbl_data, 1, data)) {
  2230. err = -EINVAL;
  2231. goto out_free;
  2232. }
  2233. if (!err && left)
  2234. left -= proc_skip_spaces(&p);
  2235. out_free:
  2236. kfree(kbuf);
  2237. if (err)
  2238. return -EINVAL;
  2239. return 0;
  2240. /* This is in keeping with old __do_proc_dointvec() */
  2241. bail_early:
  2242. *ppos += *lenp;
  2243. return err;
  2244. }
  2245. static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer,
  2246. size_t *lenp, loff_t *ppos,
  2247. int (*conv)(unsigned long *lvalp,
  2248. unsigned int *valp,
  2249. int write, void *data),
  2250. void *data)
  2251. {
  2252. unsigned long lval;
  2253. int err = 0;
  2254. size_t left;
  2255. left = *lenp;
  2256. if (conv(&lval, tbl_data, 0, data)) {
  2257. err = -EINVAL;
  2258. goto out;
  2259. }
  2260. err = proc_put_long(&buffer, &left, lval, false);
  2261. if (err || !left)
  2262. goto out;
  2263. err = proc_put_char(&buffer, &left, '\n');
  2264. out:
  2265. *lenp -= left;
  2266. *ppos += *lenp;
  2267. return err;
  2268. }
  2269. static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
  2270. int write, void __user *buffer,
  2271. size_t *lenp, loff_t *ppos,
  2272. int (*conv)(unsigned long *lvalp,
  2273. unsigned int *valp,
  2274. int write, void *data),
  2275. void *data)
  2276. {
  2277. unsigned int *i, vleft;
  2278. if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2279. *lenp = 0;
  2280. return 0;
  2281. }
  2282. i = (unsigned int *) tbl_data;
  2283. vleft = table->maxlen / sizeof(*i);
  2284. /*
  2285. * Arrays are not supported, keep this simple. *Do not* add
  2286. * support for them.
  2287. */
  2288. if (vleft != 1) {
  2289. *lenp = 0;
  2290. return -EINVAL;
  2291. }
  2292. if (!conv)
  2293. conv = do_proc_douintvec_conv;
  2294. if (write)
  2295. return do_proc_douintvec_w(i, table, buffer, lenp, ppos,
  2296. conv, data);
  2297. return do_proc_douintvec_r(i, buffer, lenp, ppos, conv, data);
  2298. }
  2299. static int do_proc_douintvec(struct ctl_table *table, int write,
  2300. void __user *buffer, size_t *lenp, loff_t *ppos,
  2301. int (*conv)(unsigned long *lvalp,
  2302. unsigned int *valp,
  2303. int write, void *data),
  2304. void *data)
  2305. {
  2306. return __do_proc_douintvec(table->data, table, write,
  2307. buffer, lenp, ppos, conv, data);
  2308. }
  2309. /**
  2310. * proc_dointvec - read a vector of integers
  2311. * @table: the sysctl table
  2312. * @write: %TRUE if this is a write to the sysctl file
  2313. * @buffer: the user buffer
  2314. * @lenp: the size of the user buffer
  2315. * @ppos: file position
  2316. *
  2317. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2318. * values from/to the user buffer, treated as an ASCII string.
  2319. *
  2320. * Returns 0 on success.
  2321. */
  2322. int proc_dointvec(struct ctl_table *table, int write,
  2323. void __user *buffer, size_t *lenp, loff_t *ppos)
  2324. {
  2325. return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
  2326. }
  2327. /**
  2328. * proc_douintvec - read a vector of unsigned integers
  2329. * @table: the sysctl table
  2330. * @write: %TRUE if this is a write to the sysctl file
  2331. * @buffer: the user buffer
  2332. * @lenp: the size of the user buffer
  2333. * @ppos: file position
  2334. *
  2335. * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
  2336. * values from/to the user buffer, treated as an ASCII string.
  2337. *
  2338. * Returns 0 on success.
  2339. */
  2340. int proc_douintvec(struct ctl_table *table, int write,
  2341. void __user *buffer, size_t *lenp, loff_t *ppos)
  2342. {
  2343. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2344. do_proc_douintvec_conv, NULL);
  2345. }
  2346. /*
  2347. * Taint values can only be increased
  2348. * This means we can safely use a temporary.
  2349. */
  2350. static int proc_taint(struct ctl_table *table, int write,
  2351. void __user *buffer, size_t *lenp, loff_t *ppos)
  2352. {
  2353. struct ctl_table t;
  2354. unsigned long tmptaint = get_taint();
  2355. int err;
  2356. if (write && !capable(CAP_SYS_ADMIN))
  2357. return -EPERM;
  2358. t = *table;
  2359. t.data = &tmptaint;
  2360. err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
  2361. if (err < 0)
  2362. return err;
  2363. if (write) {
  2364. /*
  2365. * Poor man's atomic or. Not worth adding a primitive
  2366. * to everyone's atomic.h for this
  2367. */
  2368. int i;
  2369. for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
  2370. if ((tmptaint >> i) & 1)
  2371. add_taint(i, LOCKDEP_STILL_OK);
  2372. }
  2373. }
  2374. return err;
  2375. }
  2376. #ifdef CONFIG_PRINTK
  2377. static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
  2378. void __user *buffer, size_t *lenp, loff_t *ppos)
  2379. {
  2380. if (write && !capable(CAP_SYS_ADMIN))
  2381. return -EPERM;
  2382. return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  2383. }
  2384. #endif
  2385. /**
  2386. * struct do_proc_dointvec_minmax_conv_param - proc_dointvec_minmax() range checking structure
  2387. * @min: pointer to minimum allowable value
  2388. * @max: pointer to maximum allowable value
  2389. *
  2390. * The do_proc_dointvec_minmax_conv_param structure provides the
  2391. * minimum and maximum values for doing range checking for those sysctl
  2392. * parameters that use the proc_dointvec_minmax() handler.
  2393. */
  2394. struct do_proc_dointvec_minmax_conv_param {
  2395. int *min;
  2396. int *max;
  2397. };
  2398. static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
  2399. int *valp,
  2400. int write, void *data)
  2401. {
  2402. struct do_proc_dointvec_minmax_conv_param *param = data;
  2403. if (write) {
  2404. int val = *negp ? -*lvalp : *lvalp;
  2405. if ((param->min && *param->min > val) ||
  2406. (param->max && *param->max < val))
  2407. return -EINVAL;
  2408. *valp = val;
  2409. } else {
  2410. int val = *valp;
  2411. if (val < 0) {
  2412. *negp = true;
  2413. *lvalp = -(unsigned long)val;
  2414. } else {
  2415. *negp = false;
  2416. *lvalp = (unsigned long)val;
  2417. }
  2418. }
  2419. return 0;
  2420. }
  2421. /**
  2422. * proc_dointvec_minmax - read a vector of integers with min/max values
  2423. * @table: the sysctl table
  2424. * @write: %TRUE if this is a write to the sysctl file
  2425. * @buffer: the user buffer
  2426. * @lenp: the size of the user buffer
  2427. * @ppos: file position
  2428. *
  2429. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2430. * values from/to the user buffer, treated as an ASCII string.
  2431. *
  2432. * This routine will ensure the values are within the range specified by
  2433. * table->extra1 (min) and table->extra2 (max).
  2434. *
  2435. * Returns 0 on success or -EINVAL on write when the range check fails.
  2436. */
  2437. int proc_dointvec_minmax(struct ctl_table *table, int write,
  2438. void __user *buffer, size_t *lenp, loff_t *ppos)
  2439. {
  2440. struct do_proc_dointvec_minmax_conv_param param = {
  2441. .min = (int *) table->extra1,
  2442. .max = (int *) table->extra2,
  2443. };
  2444. return do_proc_dointvec(table, write, buffer, lenp, ppos,
  2445. do_proc_dointvec_minmax_conv, &param);
  2446. }
  2447. /**
  2448. * struct do_proc_douintvec_minmax_conv_param - proc_douintvec_minmax() range checking structure
  2449. * @min: pointer to minimum allowable value
  2450. * @max: pointer to maximum allowable value
  2451. *
  2452. * The do_proc_douintvec_minmax_conv_param structure provides the
  2453. * minimum and maximum values for doing range checking for those sysctl
  2454. * parameters that use the proc_douintvec_minmax() handler.
  2455. */
  2456. struct do_proc_douintvec_minmax_conv_param {
  2457. unsigned int *min;
  2458. unsigned int *max;
  2459. };
  2460. static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
  2461. unsigned int *valp,
  2462. int write, void *data)
  2463. {
  2464. struct do_proc_douintvec_minmax_conv_param *param = data;
  2465. if (write) {
  2466. unsigned int val = *lvalp;
  2467. if (*lvalp > UINT_MAX)
  2468. return -EINVAL;
  2469. if ((param->min && *param->min > val) ||
  2470. (param->max && *param->max < val))
  2471. return -ERANGE;
  2472. *valp = val;
  2473. } else {
  2474. unsigned int val = *valp;
  2475. *lvalp = (unsigned long) val;
  2476. }
  2477. return 0;
  2478. }
  2479. /**
  2480. * proc_douintvec_minmax - read a vector of unsigned ints with min/max values
  2481. * @table: the sysctl table
  2482. * @write: %TRUE if this is a write to the sysctl file
  2483. * @buffer: the user buffer
  2484. * @lenp: the size of the user buffer
  2485. * @ppos: file position
  2486. *
  2487. * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
  2488. * values from/to the user buffer, treated as an ASCII string. Negative
  2489. * strings are not allowed.
  2490. *
  2491. * This routine will ensure the values are within the range specified by
  2492. * table->extra1 (min) and table->extra2 (max). There is a final sanity
  2493. * check for UINT_MAX to avoid having to support wrap around uses from
  2494. * userspace.
  2495. *
  2496. * Returns 0 on success or -ERANGE on write when the range check fails.
  2497. */
  2498. int proc_douintvec_minmax(struct ctl_table *table, int write,
  2499. void __user *buffer, size_t *lenp, loff_t *ppos)
  2500. {
  2501. struct do_proc_douintvec_minmax_conv_param param = {
  2502. .min = (unsigned int *) table->extra1,
  2503. .max = (unsigned int *) table->extra2,
  2504. };
  2505. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2506. do_proc_douintvec_minmax_conv, &param);
  2507. }
  2508. static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
  2509. unsigned int *valp,
  2510. int write, void *data)
  2511. {
  2512. if (write) {
  2513. unsigned int val;
  2514. val = round_pipe_size(*lvalp);
  2515. if (val == 0)
  2516. return -EINVAL;
  2517. *valp = val;
  2518. } else {
  2519. unsigned int val = *valp;
  2520. *lvalp = (unsigned long) val;
  2521. }
  2522. return 0;
  2523. }
  2524. static int proc_dopipe_max_size(struct ctl_table *table, int write,
  2525. void __user *buffer, size_t *lenp, loff_t *ppos)
  2526. {
  2527. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2528. do_proc_dopipe_max_size_conv, NULL);
  2529. }
  2530. static void validate_coredump_safety(void)
  2531. {
  2532. #ifdef CONFIG_COREDUMP
  2533. if (suid_dumpable == SUID_DUMP_ROOT &&
  2534. core_pattern[0] != '/' && core_pattern[0] != '|') {
  2535. printk(KERN_WARNING
  2536. "Unsafe core_pattern used with fs.suid_dumpable=2.\n"
  2537. "Pipe handler or fully qualified core dump path required.\n"
  2538. "Set kernel.core_pattern before fs.suid_dumpable.\n"
  2539. );
  2540. }
  2541. #endif
  2542. }
  2543. static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  2544. void __user *buffer, size_t *lenp, loff_t *ppos)
  2545. {
  2546. int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  2547. if (!error)
  2548. validate_coredump_safety();
  2549. return error;
  2550. }
  2551. #ifdef CONFIG_COREDUMP
  2552. static int proc_dostring_coredump(struct ctl_table *table, int write,
  2553. void __user *buffer, size_t *lenp, loff_t *ppos)
  2554. {
  2555. int error = proc_dostring(table, write, buffer, lenp, ppos);
  2556. if (!error)
  2557. validate_coredump_safety();
  2558. return error;
  2559. }
  2560. #endif
  2561. static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
  2562. void __user *buffer,
  2563. size_t *lenp, loff_t *ppos,
  2564. unsigned long convmul,
  2565. unsigned long convdiv)
  2566. {
  2567. unsigned long *i, *min, *max;
  2568. int vleft, first = 1, err = 0;
  2569. size_t left;
  2570. char *kbuf = NULL, *p;
  2571. if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2572. *lenp = 0;
  2573. return 0;
  2574. }
  2575. i = (unsigned long *) data;
  2576. min = (unsigned long *) table->extra1;
  2577. max = (unsigned long *) table->extra2;
  2578. vleft = table->maxlen / sizeof(unsigned long);
  2579. left = *lenp;
  2580. if (write) {
  2581. if (proc_first_pos_non_zero_ignore(ppos, table))
  2582. goto out;
  2583. if (left > PAGE_SIZE - 1)
  2584. left = PAGE_SIZE - 1;
  2585. p = kbuf = memdup_user_nul(buffer, left);
  2586. if (IS_ERR(kbuf))
  2587. return PTR_ERR(kbuf);
  2588. }
  2589. for (; left && vleft--; i++, first = 0) {
  2590. unsigned long val;
  2591. if (write) {
  2592. bool neg;
  2593. left -= proc_skip_spaces(&p);
  2594. err = proc_get_long(&p, &left, &val, &neg,
  2595. proc_wspace_sep,
  2596. sizeof(proc_wspace_sep), NULL);
  2597. if (err)
  2598. break;
  2599. if (neg)
  2600. continue;
  2601. val = convmul * val / convdiv;
  2602. if ((min && val < *min) || (max && val > *max))
  2603. continue;
  2604. *i = val;
  2605. } else {
  2606. val = convdiv * (*i) / convmul;
  2607. if (!first) {
  2608. err = proc_put_char(&buffer, &left, '\t');
  2609. if (err)
  2610. break;
  2611. }
  2612. err = proc_put_long(&buffer, &left, val, false);
  2613. if (err)
  2614. break;
  2615. }
  2616. }
  2617. if (!write && !first && left && !err)
  2618. err = proc_put_char(&buffer, &left, '\n');
  2619. if (write && !err)
  2620. left -= proc_skip_spaces(&p);
  2621. if (write) {
  2622. kfree(kbuf);
  2623. if (first)
  2624. return err ? : -EINVAL;
  2625. }
  2626. *lenp -= left;
  2627. out:
  2628. *ppos += *lenp;
  2629. return err;
  2630. }
  2631. static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
  2632. void __user *buffer,
  2633. size_t *lenp, loff_t *ppos,
  2634. unsigned long convmul,
  2635. unsigned long convdiv)
  2636. {
  2637. return __do_proc_doulongvec_minmax(table->data, table, write,
  2638. buffer, lenp, ppos, convmul, convdiv);
  2639. }
  2640. /**
  2641. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  2642. * @table: the sysctl table
  2643. * @write: %TRUE if this is a write to the sysctl file
  2644. * @buffer: the user buffer
  2645. * @lenp: the size of the user buffer
  2646. * @ppos: file position
  2647. *
  2648. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2649. * values from/to the user buffer, treated as an ASCII string.
  2650. *
  2651. * This routine will ensure the values are within the range specified by
  2652. * table->extra1 (min) and table->extra2 (max).
  2653. *
  2654. * Returns 0 on success.
  2655. */
  2656. int proc_doulongvec_minmax(struct ctl_table *table, int write,
  2657. void __user *buffer, size_t *lenp, loff_t *ppos)
  2658. {
  2659. return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
  2660. }
  2661. /**
  2662. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  2663. * @table: the sysctl table
  2664. * @write: %TRUE if this is a write to the sysctl file
  2665. * @buffer: the user buffer
  2666. * @lenp: the size of the user buffer
  2667. * @ppos: file position
  2668. *
  2669. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2670. * values from/to the user buffer, treated as an ASCII string. The values
  2671. * are treated as milliseconds, and converted to jiffies when they are stored.
  2672. *
  2673. * This routine will ensure the values are within the range specified by
  2674. * table->extra1 (min) and table->extra2 (max).
  2675. *
  2676. * Returns 0 on success.
  2677. */
  2678. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  2679. void __user *buffer,
  2680. size_t *lenp, loff_t *ppos)
  2681. {
  2682. return do_proc_doulongvec_minmax(table, write, buffer,
  2683. lenp, ppos, HZ, 1000l);
  2684. }
  2685. static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
  2686. int *valp,
  2687. int write, void *data)
  2688. {
  2689. if (write) {
  2690. if (*lvalp > INT_MAX / HZ)
  2691. return 1;
  2692. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  2693. } else {
  2694. int val = *valp;
  2695. unsigned long lval;
  2696. if (val < 0) {
  2697. *negp = true;
  2698. lval = -(unsigned long)val;
  2699. } else {
  2700. *negp = false;
  2701. lval = (unsigned long)val;
  2702. }
  2703. *lvalp = lval / HZ;
  2704. }
  2705. return 0;
  2706. }
  2707. static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
  2708. int *valp,
  2709. int write, void *data)
  2710. {
  2711. if (write) {
  2712. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2713. return 1;
  2714. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2715. } else {
  2716. int val = *valp;
  2717. unsigned long lval;
  2718. if (val < 0) {
  2719. *negp = true;
  2720. lval = -(unsigned long)val;
  2721. } else {
  2722. *negp = false;
  2723. lval = (unsigned long)val;
  2724. }
  2725. *lvalp = jiffies_to_clock_t(lval);
  2726. }
  2727. return 0;
  2728. }
  2729. static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
  2730. int *valp,
  2731. int write, void *data)
  2732. {
  2733. if (write) {
  2734. unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  2735. if (jif > INT_MAX)
  2736. return 1;
  2737. *valp = (int)jif;
  2738. } else {
  2739. int val = *valp;
  2740. unsigned long lval;
  2741. if (val < 0) {
  2742. *negp = true;
  2743. lval = -(unsigned long)val;
  2744. } else {
  2745. *negp = false;
  2746. lval = (unsigned long)val;
  2747. }
  2748. *lvalp = jiffies_to_msecs(lval);
  2749. }
  2750. return 0;
  2751. }
  2752. /**
  2753. * proc_dointvec_jiffies - read a vector of integers as seconds
  2754. * @table: the sysctl table
  2755. * @write: %TRUE if this is a write to the sysctl file
  2756. * @buffer: the user buffer
  2757. * @lenp: the size of the user buffer
  2758. * @ppos: file position
  2759. *
  2760. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2761. * values from/to the user buffer, treated as an ASCII string.
  2762. * The values read are assumed to be in seconds, and are converted into
  2763. * jiffies.
  2764. *
  2765. * Returns 0 on success.
  2766. */
  2767. int proc_dointvec_jiffies(struct ctl_table *table, int write,
  2768. void __user *buffer, size_t *lenp, loff_t *ppos)
  2769. {
  2770. return do_proc_dointvec(table,write,buffer,lenp,ppos,
  2771. do_proc_dointvec_jiffies_conv,NULL);
  2772. }
  2773. /**
  2774. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2775. * @table: the sysctl table
  2776. * @write: %TRUE if this is a write to the sysctl file
  2777. * @buffer: the user buffer
  2778. * @lenp: the size of the user buffer
  2779. * @ppos: pointer to the file position
  2780. *
  2781. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2782. * values from/to the user buffer, treated as an ASCII string.
  2783. * The values read are assumed to be in 1/USER_HZ seconds, and
  2784. * are converted into jiffies.
  2785. *
  2786. * Returns 0 on success.
  2787. */
  2788. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
  2789. void __user *buffer, size_t *lenp, loff_t *ppos)
  2790. {
  2791. return do_proc_dointvec(table,write,buffer,lenp,ppos,
  2792. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2793. }
  2794. /**
  2795. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2796. * @table: the sysctl table
  2797. * @write: %TRUE if this is a write to the sysctl file
  2798. * @buffer: the user buffer
  2799. * @lenp: the size of the user buffer
  2800. * @ppos: file position
  2801. * @ppos: the current position in the file
  2802. *
  2803. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2804. * values from/to the user buffer, treated as an ASCII string.
  2805. * The values read are assumed to be in 1/1000 seconds, and
  2806. * are converted into jiffies.
  2807. *
  2808. * Returns 0 on success.
  2809. */
  2810. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
  2811. void __user *buffer, size_t *lenp, loff_t *ppos)
  2812. {
  2813. return do_proc_dointvec(table, write, buffer, lenp, ppos,
  2814. do_proc_dointvec_ms_jiffies_conv, NULL);
  2815. }
  2816. static int proc_do_cad_pid(struct ctl_table *table, int write,
  2817. void __user *buffer, size_t *lenp, loff_t *ppos)
  2818. {
  2819. struct pid *new_pid;
  2820. pid_t tmp;
  2821. int r;
  2822. tmp = pid_vnr(cad_pid);
  2823. r = __do_proc_dointvec(&tmp, table, write, buffer,
  2824. lenp, ppos, NULL, NULL);
  2825. if (r || !write)
  2826. return r;
  2827. new_pid = find_get_pid(tmp);
  2828. if (!new_pid)
  2829. return -ESRCH;
  2830. put_pid(xchg(&cad_pid, new_pid));
  2831. return 0;
  2832. }
  2833. /**
  2834. * proc_do_large_bitmap - read/write from/to a large bitmap
  2835. * @table: the sysctl table
  2836. * @write: %TRUE if this is a write to the sysctl file
  2837. * @buffer: the user buffer
  2838. * @lenp: the size of the user buffer
  2839. * @ppos: file position
  2840. *
  2841. * The bitmap is stored at table->data and the bitmap length (in bits)
  2842. * in table->maxlen.
  2843. *
  2844. * We use a range comma separated format (e.g. 1,3-4,10-10) so that
  2845. * large bitmaps may be represented in a compact manner. Writing into
  2846. * the file will clear the bitmap then update it with the given input.
  2847. *
  2848. * Returns 0 on success.
  2849. */
  2850. int proc_do_large_bitmap(struct ctl_table *table, int write,
  2851. void __user *buffer, size_t *lenp, loff_t *ppos)
  2852. {
  2853. int err = 0;
  2854. bool first = 1;
  2855. size_t left = *lenp;
  2856. unsigned long bitmap_len = table->maxlen;
  2857. unsigned long *bitmap = *(unsigned long **) table->data;
  2858. unsigned long *tmp_bitmap = NULL;
  2859. char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
  2860. if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
  2861. *lenp = 0;
  2862. return 0;
  2863. }
  2864. if (write) {
  2865. char *kbuf, *p;
  2866. if (left > PAGE_SIZE - 1)
  2867. left = PAGE_SIZE - 1;
  2868. p = kbuf = memdup_user_nul(buffer, left);
  2869. if (IS_ERR(kbuf))
  2870. return PTR_ERR(kbuf);
  2871. tmp_bitmap = kcalloc(BITS_TO_LONGS(bitmap_len),
  2872. sizeof(unsigned long),
  2873. GFP_KERNEL);
  2874. if (!tmp_bitmap) {
  2875. kfree(kbuf);
  2876. return -ENOMEM;
  2877. }
  2878. proc_skip_char(&p, &left, '\n');
  2879. while (!err && left) {
  2880. unsigned long val_a, val_b;
  2881. bool neg;
  2882. err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
  2883. sizeof(tr_a), &c);
  2884. if (err)
  2885. break;
  2886. if (val_a >= bitmap_len || neg) {
  2887. err = -EINVAL;
  2888. break;
  2889. }
  2890. val_b = val_a;
  2891. if (left) {
  2892. p++;
  2893. left--;
  2894. }
  2895. if (c == '-') {
  2896. err = proc_get_long(&p, &left, &val_b,
  2897. &neg, tr_b, sizeof(tr_b),
  2898. &c);
  2899. if (err)
  2900. break;
  2901. if (val_b >= bitmap_len || neg ||
  2902. val_a > val_b) {
  2903. err = -EINVAL;
  2904. break;
  2905. }
  2906. if (left) {
  2907. p++;
  2908. left--;
  2909. }
  2910. }
  2911. bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
  2912. first = 0;
  2913. proc_skip_char(&p, &left, '\n');
  2914. }
  2915. kfree(kbuf);
  2916. } else {
  2917. unsigned long bit_a, bit_b = 0;
  2918. while (left) {
  2919. bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
  2920. if (bit_a >= bitmap_len)
  2921. break;
  2922. bit_b = find_next_zero_bit(bitmap, bitmap_len,
  2923. bit_a + 1) - 1;
  2924. if (!first) {
  2925. err = proc_put_char(&buffer, &left, ',');
  2926. if (err)
  2927. break;
  2928. }
  2929. err = proc_put_long(&buffer, &left, bit_a, false);
  2930. if (err)
  2931. break;
  2932. if (bit_a != bit_b) {
  2933. err = proc_put_char(&buffer, &left, '-');
  2934. if (err)
  2935. break;
  2936. err = proc_put_long(&buffer, &left, bit_b, false);
  2937. if (err)
  2938. break;
  2939. }
  2940. first = 0; bit_b++;
  2941. }
  2942. if (!err)
  2943. err = proc_put_char(&buffer, &left, '\n');
  2944. }
  2945. if (!err) {
  2946. if (write) {
  2947. if (*ppos)
  2948. bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
  2949. else
  2950. bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
  2951. }
  2952. *lenp -= left;
  2953. *ppos += *lenp;
  2954. }
  2955. kfree(tmp_bitmap);
  2956. return err;
  2957. }
  2958. #else /* CONFIG_PROC_SYSCTL */
  2959. int proc_dostring(struct ctl_table *table, int write,
  2960. void __user *buffer, size_t *lenp, loff_t *ppos)
  2961. {
  2962. return -ENOSYS;
  2963. }
  2964. int proc_dointvec(struct ctl_table *table, int write,
  2965. void __user *buffer, size_t *lenp, loff_t *ppos)
  2966. {
  2967. return -ENOSYS;
  2968. }
  2969. int proc_douintvec(struct ctl_table *table, int write,
  2970. void __user *buffer, size_t *lenp, loff_t *ppos)
  2971. {
  2972. return -ENOSYS;
  2973. }
  2974. int proc_dointvec_minmax(struct ctl_table *table, int write,
  2975. void __user *buffer, size_t *lenp, loff_t *ppos)
  2976. {
  2977. return -ENOSYS;
  2978. }
  2979. int proc_douintvec_minmax(struct ctl_table *table, int write,
  2980. void __user *buffer, size_t *lenp, loff_t *ppos)
  2981. {
  2982. return -ENOSYS;
  2983. }
  2984. int proc_dointvec_jiffies(struct ctl_table *table, int write,
  2985. void __user *buffer, size_t *lenp, loff_t *ppos)
  2986. {
  2987. return -ENOSYS;
  2988. }
  2989. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
  2990. void __user *buffer, size_t *lenp, loff_t *ppos)
  2991. {
  2992. return -ENOSYS;
  2993. }
  2994. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
  2995. void __user *buffer, size_t *lenp, loff_t *ppos)
  2996. {
  2997. return -ENOSYS;
  2998. }
  2999. int proc_doulongvec_minmax(struct ctl_table *table, int write,
  3000. void __user *buffer, size_t *lenp, loff_t *ppos)
  3001. {
  3002. return -ENOSYS;
  3003. }
  3004. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  3005. void __user *buffer,
  3006. size_t *lenp, loff_t *ppos)
  3007. {
  3008. return -ENOSYS;
  3009. }
  3010. #endif /* CONFIG_PROC_SYSCTL */
  3011. /*
  3012. * No sense putting this after each symbol definition, twice,
  3013. * exception granted :-)
  3014. */
  3015. EXPORT_SYMBOL(proc_dointvec);
  3016. EXPORT_SYMBOL(proc_douintvec);
  3017. EXPORT_SYMBOL(proc_dointvec_jiffies);
  3018. EXPORT_SYMBOL(proc_dointvec_minmax);
  3019. EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
  3020. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  3021. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  3022. EXPORT_SYMBOL(proc_dostring);
  3023. EXPORT_SYMBOL(proc_doulongvec_minmax);
  3024. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);