sysctl.c 74 KB

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