sysctl.c 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151
  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/mm.h>
  22. #include <linux/swap.h>
  23. #include <linux/slab.h>
  24. #include <linux/sysctl.h>
  25. #include <linux/proc_fs.h>
  26. #include <linux/security.h>
  27. #include <linux/ctype.h>
  28. #include <linux/utsname.h>
  29. #include <linux/smp_lock.h>
  30. #include <linux/fs.h>
  31. #include <linux/init.h>
  32. #include <linux/kernel.h>
  33. #include <linux/kobject.h>
  34. #include <linux/net.h>
  35. #include <linux/sysrq.h>
  36. #include <linux/highuid.h>
  37. #include <linux/writeback.h>
  38. #include <linux/hugetlb.h>
  39. #include <linux/initrd.h>
  40. #include <linux/key.h>
  41. #include <linux/times.h>
  42. #include <linux/limits.h>
  43. #include <linux/dcache.h>
  44. #include <linux/syscalls.h>
  45. #include <linux/vmstat.h>
  46. #include <linux/nfs_fs.h>
  47. #include <linux/acpi.h>
  48. #include <linux/reboot.h>
  49. #include <linux/ftrace.h>
  50. #include <linux/slow-work.h>
  51. #include <asm/uaccess.h>
  52. #include <asm/processor.h>
  53. #ifdef CONFIG_X86
  54. #include <asm/nmi.h>
  55. #include <asm/stacktrace.h>
  56. #include <asm/io.h>
  57. #endif
  58. static int deprecated_sysctl_warning(struct __sysctl_args *args);
  59. #if defined(CONFIG_SYSCTL)
  60. /* External variables not in a header file. */
  61. extern int C_A_D;
  62. extern int print_fatal_signals;
  63. extern int sysctl_overcommit_memory;
  64. extern int sysctl_overcommit_ratio;
  65. extern int sysctl_panic_on_oom;
  66. extern int sysctl_oom_kill_allocating_task;
  67. extern int sysctl_oom_dump_tasks;
  68. extern int max_threads;
  69. extern int core_uses_pid;
  70. extern int suid_dumpable;
  71. extern char core_pattern[];
  72. extern int pid_max;
  73. extern int min_free_kbytes;
  74. extern int pid_max_min, pid_max_max;
  75. extern int sysctl_drop_caches;
  76. extern int percpu_pagelist_fraction;
  77. extern int compat_log;
  78. extern int latencytop_enabled;
  79. extern int sysctl_nr_open_min, sysctl_nr_open_max;
  80. #ifndef CONFIG_MMU
  81. extern int sysctl_nr_trim_pages;
  82. #endif
  83. #ifdef CONFIG_RCU_TORTURE_TEST
  84. extern int rcutorture_runnable;
  85. #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
  86. /* Constants used for minimum and maximum */
  87. #ifdef CONFIG_DETECT_SOFTLOCKUP
  88. static int sixty = 60;
  89. static int neg_one = -1;
  90. #endif
  91. static int zero;
  92. static int __maybe_unused one = 1;
  93. static int __maybe_unused two = 2;
  94. static unsigned long one_ul = 1;
  95. static int one_hundred = 100;
  96. static int one_thousand = 1000;
  97. /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
  98. static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
  99. /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  100. static int maxolduid = 65535;
  101. static int minolduid;
  102. static int min_percpu_pagelist_fract = 8;
  103. static int ngroups_max = NGROUPS_MAX;
  104. #ifdef CONFIG_MODULES
  105. extern char modprobe_path[];
  106. #endif
  107. #ifdef CONFIG_CHR_DEV_SG
  108. extern int sg_big_buff;
  109. #endif
  110. #ifdef CONFIG_SPARC
  111. #include <asm/system.h>
  112. #endif
  113. #ifdef CONFIG_SPARC64
  114. extern int sysctl_tsb_ratio;
  115. #endif
  116. #ifdef __hppa__
  117. extern int pwrsw_enabled;
  118. extern int unaligned_enabled;
  119. #endif
  120. #ifdef CONFIG_S390
  121. #ifdef CONFIG_MATHEMU
  122. extern int sysctl_ieee_emulation_warnings;
  123. #endif
  124. extern int sysctl_userprocess_debug;
  125. extern int spin_retry;
  126. #endif
  127. #ifdef CONFIG_BSD_PROCESS_ACCT
  128. extern int acct_parm[];
  129. #endif
  130. #ifdef CONFIG_IA64
  131. extern int no_unaligned_warning;
  132. extern int unaligned_dump_stack;
  133. #endif
  134. #ifdef CONFIG_RT_MUTEXES
  135. extern int max_lock_depth;
  136. #endif
  137. #ifdef CONFIG_PROC_SYSCTL
  138. static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
  139. void __user *buffer, size_t *lenp, loff_t *ppos);
  140. static int proc_taint(struct ctl_table *table, int write, struct file *filp,
  141. void __user *buffer, size_t *lenp, loff_t *ppos);
  142. #endif
  143. static struct ctl_table root_table[];
  144. static struct ctl_table_root sysctl_table_root;
  145. static struct ctl_table_header root_table_header = {
  146. .count = 1,
  147. .ctl_table = root_table,
  148. .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
  149. .root = &sysctl_table_root,
  150. .set = &sysctl_table_root.default_set,
  151. };
  152. static struct ctl_table_root sysctl_table_root = {
  153. .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
  154. .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
  155. };
  156. static struct ctl_table kern_table[];
  157. static struct ctl_table vm_table[];
  158. static struct ctl_table fs_table[];
  159. static struct ctl_table debug_table[];
  160. static struct ctl_table dev_table[];
  161. extern struct ctl_table random_table[];
  162. #ifdef CONFIG_INOTIFY_USER
  163. extern struct ctl_table inotify_table[];
  164. #endif
  165. #ifdef CONFIG_EPOLL
  166. extern struct ctl_table epoll_table[];
  167. #endif
  168. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  169. int sysctl_legacy_va_layout;
  170. #endif
  171. extern int prove_locking;
  172. extern int lock_stat;
  173. /* The default sysctl tables: */
  174. static struct ctl_table root_table[] = {
  175. {
  176. .ctl_name = CTL_KERN,
  177. .procname = "kernel",
  178. .mode = 0555,
  179. .child = kern_table,
  180. },
  181. {
  182. .ctl_name = CTL_VM,
  183. .procname = "vm",
  184. .mode = 0555,
  185. .child = vm_table,
  186. },
  187. {
  188. .ctl_name = CTL_FS,
  189. .procname = "fs",
  190. .mode = 0555,
  191. .child = fs_table,
  192. },
  193. {
  194. .ctl_name = CTL_DEBUG,
  195. .procname = "debug",
  196. .mode = 0555,
  197. .child = debug_table,
  198. },
  199. {
  200. .ctl_name = CTL_DEV,
  201. .procname = "dev",
  202. .mode = 0555,
  203. .child = dev_table,
  204. },
  205. /*
  206. * NOTE: do not add new entries to this table unless you have read
  207. * Documentation/sysctl/ctl_unnumbered.txt
  208. */
  209. { .ctl_name = 0 }
  210. };
  211. #ifdef CONFIG_SCHED_DEBUG
  212. static int min_sched_granularity_ns = 100000; /* 100 usecs */
  213. static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
  214. static int min_wakeup_granularity_ns; /* 0 usecs */
  215. static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
  216. #endif
  217. static struct ctl_table kern_table[] = {
  218. #ifdef CONFIG_SCHED_DEBUG
  219. {
  220. .ctl_name = CTL_UNNUMBERED,
  221. .procname = "sched_min_granularity_ns",
  222. .data = &sysctl_sched_min_granularity,
  223. .maxlen = sizeof(unsigned int),
  224. .mode = 0644,
  225. .proc_handler = &sched_nr_latency_handler,
  226. .strategy = &sysctl_intvec,
  227. .extra1 = &min_sched_granularity_ns,
  228. .extra2 = &max_sched_granularity_ns,
  229. },
  230. {
  231. .ctl_name = CTL_UNNUMBERED,
  232. .procname = "sched_latency_ns",
  233. .data = &sysctl_sched_latency,
  234. .maxlen = sizeof(unsigned int),
  235. .mode = 0644,
  236. .proc_handler = &sched_nr_latency_handler,
  237. .strategy = &sysctl_intvec,
  238. .extra1 = &min_sched_granularity_ns,
  239. .extra2 = &max_sched_granularity_ns,
  240. },
  241. {
  242. .ctl_name = CTL_UNNUMBERED,
  243. .procname = "sched_wakeup_granularity_ns",
  244. .data = &sysctl_sched_wakeup_granularity,
  245. .maxlen = sizeof(unsigned int),
  246. .mode = 0644,
  247. .proc_handler = &proc_dointvec_minmax,
  248. .strategy = &sysctl_intvec,
  249. .extra1 = &min_wakeup_granularity_ns,
  250. .extra2 = &max_wakeup_granularity_ns,
  251. },
  252. {
  253. .ctl_name = CTL_UNNUMBERED,
  254. .procname = "sched_shares_ratelimit",
  255. .data = &sysctl_sched_shares_ratelimit,
  256. .maxlen = sizeof(unsigned int),
  257. .mode = 0644,
  258. .proc_handler = &proc_dointvec,
  259. },
  260. {
  261. .ctl_name = CTL_UNNUMBERED,
  262. .procname = "sched_shares_thresh",
  263. .data = &sysctl_sched_shares_thresh,
  264. .maxlen = sizeof(unsigned int),
  265. .mode = 0644,
  266. .proc_handler = &proc_dointvec_minmax,
  267. .strategy = &sysctl_intvec,
  268. .extra1 = &zero,
  269. },
  270. {
  271. .ctl_name = CTL_UNNUMBERED,
  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. {
  279. .ctl_name = CTL_UNNUMBERED,
  280. .procname = "sched_features",
  281. .data = &sysctl_sched_features,
  282. .maxlen = sizeof(unsigned int),
  283. .mode = 0644,
  284. .proc_handler = &proc_dointvec,
  285. },
  286. {
  287. .ctl_name = CTL_UNNUMBERED,
  288. .procname = "sched_migration_cost",
  289. .data = &sysctl_sched_migration_cost,
  290. .maxlen = sizeof(unsigned int),
  291. .mode = 0644,
  292. .proc_handler = &proc_dointvec,
  293. },
  294. {
  295. .ctl_name = CTL_UNNUMBERED,
  296. .procname = "sched_nr_migrate",
  297. .data = &sysctl_sched_nr_migrate,
  298. .maxlen = sizeof(unsigned int),
  299. .mode = 0644,
  300. .proc_handler = &proc_dointvec,
  301. },
  302. #endif
  303. {
  304. .ctl_name = CTL_UNNUMBERED,
  305. .procname = "sched_rt_period_us",
  306. .data = &sysctl_sched_rt_period,
  307. .maxlen = sizeof(unsigned int),
  308. .mode = 0644,
  309. .proc_handler = &sched_rt_handler,
  310. },
  311. {
  312. .ctl_name = CTL_UNNUMBERED,
  313. .procname = "sched_rt_runtime_us",
  314. .data = &sysctl_sched_rt_runtime,
  315. .maxlen = sizeof(int),
  316. .mode = 0644,
  317. .proc_handler = &sched_rt_handler,
  318. },
  319. {
  320. .ctl_name = CTL_UNNUMBERED,
  321. .procname = "sched_compat_yield",
  322. .data = &sysctl_sched_compat_yield,
  323. .maxlen = sizeof(unsigned int),
  324. .mode = 0644,
  325. .proc_handler = &proc_dointvec,
  326. },
  327. #ifdef CONFIG_PROVE_LOCKING
  328. {
  329. .ctl_name = CTL_UNNUMBERED,
  330. .procname = "prove_locking",
  331. .data = &prove_locking,
  332. .maxlen = sizeof(int),
  333. .mode = 0644,
  334. .proc_handler = &proc_dointvec,
  335. },
  336. #endif
  337. #ifdef CONFIG_LOCK_STAT
  338. {
  339. .ctl_name = CTL_UNNUMBERED,
  340. .procname = "lock_stat",
  341. .data = &lock_stat,
  342. .maxlen = sizeof(int),
  343. .mode = 0644,
  344. .proc_handler = &proc_dointvec,
  345. },
  346. #endif
  347. {
  348. .ctl_name = KERN_PANIC,
  349. .procname = "panic",
  350. .data = &panic_timeout,
  351. .maxlen = sizeof(int),
  352. .mode = 0644,
  353. .proc_handler = &proc_dointvec,
  354. },
  355. {
  356. .ctl_name = KERN_CORE_USES_PID,
  357. .procname = "core_uses_pid",
  358. .data = &core_uses_pid,
  359. .maxlen = sizeof(int),
  360. .mode = 0644,
  361. .proc_handler = &proc_dointvec,
  362. },
  363. {
  364. .ctl_name = KERN_CORE_PATTERN,
  365. .procname = "core_pattern",
  366. .data = core_pattern,
  367. .maxlen = CORENAME_MAX_SIZE,
  368. .mode = 0644,
  369. .proc_handler = &proc_dostring,
  370. .strategy = &sysctl_string,
  371. },
  372. #ifdef CONFIG_PROC_SYSCTL
  373. {
  374. .procname = "tainted",
  375. .maxlen = sizeof(long),
  376. .mode = 0644,
  377. .proc_handler = &proc_taint,
  378. },
  379. #endif
  380. #ifdef CONFIG_LATENCYTOP
  381. {
  382. .procname = "latencytop",
  383. .data = &latencytop_enabled,
  384. .maxlen = sizeof(int),
  385. .mode = 0644,
  386. .proc_handler = &proc_dointvec,
  387. },
  388. #endif
  389. #ifdef CONFIG_BLK_DEV_INITRD
  390. {
  391. .ctl_name = KERN_REALROOTDEV,
  392. .procname = "real-root-dev",
  393. .data = &real_root_dev,
  394. .maxlen = sizeof(int),
  395. .mode = 0644,
  396. .proc_handler = &proc_dointvec,
  397. },
  398. #endif
  399. {
  400. .ctl_name = CTL_UNNUMBERED,
  401. .procname = "print-fatal-signals",
  402. .data = &print_fatal_signals,
  403. .maxlen = sizeof(int),
  404. .mode = 0644,
  405. .proc_handler = &proc_dointvec,
  406. },
  407. #ifdef CONFIG_SPARC
  408. {
  409. .ctl_name = KERN_SPARC_REBOOT,
  410. .procname = "reboot-cmd",
  411. .data = reboot_command,
  412. .maxlen = 256,
  413. .mode = 0644,
  414. .proc_handler = &proc_dostring,
  415. .strategy = &sysctl_string,
  416. },
  417. {
  418. .ctl_name = KERN_SPARC_STOP_A,
  419. .procname = "stop-a",
  420. .data = &stop_a_enabled,
  421. .maxlen = sizeof (int),
  422. .mode = 0644,
  423. .proc_handler = &proc_dointvec,
  424. },
  425. {
  426. .ctl_name = KERN_SPARC_SCONS_PWROFF,
  427. .procname = "scons-poweroff",
  428. .data = &scons_pwroff,
  429. .maxlen = sizeof (int),
  430. .mode = 0644,
  431. .proc_handler = &proc_dointvec,
  432. },
  433. #endif
  434. #ifdef CONFIG_SPARC64
  435. {
  436. .ctl_name = CTL_UNNUMBERED,
  437. .procname = "tsb-ratio",
  438. .data = &sysctl_tsb_ratio,
  439. .maxlen = sizeof (int),
  440. .mode = 0644,
  441. .proc_handler = &proc_dointvec,
  442. },
  443. #endif
  444. #ifdef __hppa__
  445. {
  446. .ctl_name = KERN_HPPA_PWRSW,
  447. .procname = "soft-power",
  448. .data = &pwrsw_enabled,
  449. .maxlen = sizeof (int),
  450. .mode = 0644,
  451. .proc_handler = &proc_dointvec,
  452. },
  453. {
  454. .ctl_name = KERN_HPPA_UNALIGNED,
  455. .procname = "unaligned-trap",
  456. .data = &unaligned_enabled,
  457. .maxlen = sizeof (int),
  458. .mode = 0644,
  459. .proc_handler = &proc_dointvec,
  460. },
  461. #endif
  462. {
  463. .ctl_name = KERN_CTLALTDEL,
  464. .procname = "ctrl-alt-del",
  465. .data = &C_A_D,
  466. .maxlen = sizeof(int),
  467. .mode = 0644,
  468. .proc_handler = &proc_dointvec,
  469. },
  470. #ifdef CONFIG_FUNCTION_TRACER
  471. {
  472. .ctl_name = CTL_UNNUMBERED,
  473. .procname = "ftrace_enabled",
  474. .data = &ftrace_enabled,
  475. .maxlen = sizeof(int),
  476. .mode = 0644,
  477. .proc_handler = &ftrace_enable_sysctl,
  478. },
  479. #endif
  480. #ifdef CONFIG_STACK_TRACER
  481. {
  482. .ctl_name = CTL_UNNUMBERED,
  483. .procname = "stack_tracer_enabled",
  484. .data = &stack_tracer_enabled,
  485. .maxlen = sizeof(int),
  486. .mode = 0644,
  487. .proc_handler = &stack_trace_sysctl,
  488. },
  489. #endif
  490. #ifdef CONFIG_TRACING
  491. {
  492. .ctl_name = CTL_UNNUMBERED,
  493. .procname = "ftrace_dump_on_oops",
  494. .data = &ftrace_dump_on_oops,
  495. .maxlen = sizeof(int),
  496. .mode = 0644,
  497. .proc_handler = &proc_dointvec,
  498. },
  499. #endif
  500. #ifdef CONFIG_MODULES
  501. {
  502. .ctl_name = KERN_MODPROBE,
  503. .procname = "modprobe",
  504. .data = &modprobe_path,
  505. .maxlen = KMOD_PATH_LEN,
  506. .mode = 0644,
  507. .proc_handler = &proc_dostring,
  508. .strategy = &sysctl_string,
  509. },
  510. #endif
  511. #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
  512. {
  513. .ctl_name = KERN_HOTPLUG,
  514. .procname = "hotplug",
  515. .data = &uevent_helper,
  516. .maxlen = UEVENT_HELPER_PATH_LEN,
  517. .mode = 0644,
  518. .proc_handler = &proc_dostring,
  519. .strategy = &sysctl_string,
  520. },
  521. #endif
  522. #ifdef CONFIG_CHR_DEV_SG
  523. {
  524. .ctl_name = KERN_SG_BIG_BUFF,
  525. .procname = "sg-big-buff",
  526. .data = &sg_big_buff,
  527. .maxlen = sizeof (int),
  528. .mode = 0444,
  529. .proc_handler = &proc_dointvec,
  530. },
  531. #endif
  532. #ifdef CONFIG_BSD_PROCESS_ACCT
  533. {
  534. .ctl_name = KERN_ACCT,
  535. .procname = "acct",
  536. .data = &acct_parm,
  537. .maxlen = 3*sizeof(int),
  538. .mode = 0644,
  539. .proc_handler = &proc_dointvec,
  540. },
  541. #endif
  542. #ifdef CONFIG_MAGIC_SYSRQ
  543. {
  544. .ctl_name = KERN_SYSRQ,
  545. .procname = "sysrq",
  546. .data = &__sysrq_enabled,
  547. .maxlen = sizeof (int),
  548. .mode = 0644,
  549. .proc_handler = &proc_dointvec,
  550. },
  551. #endif
  552. #ifdef CONFIG_PROC_SYSCTL
  553. {
  554. .procname = "cad_pid",
  555. .data = NULL,
  556. .maxlen = sizeof (int),
  557. .mode = 0600,
  558. .proc_handler = &proc_do_cad_pid,
  559. },
  560. #endif
  561. {
  562. .ctl_name = KERN_MAX_THREADS,
  563. .procname = "threads-max",
  564. .data = &max_threads,
  565. .maxlen = sizeof(int),
  566. .mode = 0644,
  567. .proc_handler = &proc_dointvec,
  568. },
  569. {
  570. .ctl_name = KERN_RANDOM,
  571. .procname = "random",
  572. .mode = 0555,
  573. .child = random_table,
  574. },
  575. {
  576. .ctl_name = KERN_OVERFLOWUID,
  577. .procname = "overflowuid",
  578. .data = &overflowuid,
  579. .maxlen = sizeof(int),
  580. .mode = 0644,
  581. .proc_handler = &proc_dointvec_minmax,
  582. .strategy = &sysctl_intvec,
  583. .extra1 = &minolduid,
  584. .extra2 = &maxolduid,
  585. },
  586. {
  587. .ctl_name = KERN_OVERFLOWGID,
  588. .procname = "overflowgid",
  589. .data = &overflowgid,
  590. .maxlen = sizeof(int),
  591. .mode = 0644,
  592. .proc_handler = &proc_dointvec_minmax,
  593. .strategy = &sysctl_intvec,
  594. .extra1 = &minolduid,
  595. .extra2 = &maxolduid,
  596. },
  597. #ifdef CONFIG_S390
  598. #ifdef CONFIG_MATHEMU
  599. {
  600. .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
  601. .procname = "ieee_emulation_warnings",
  602. .data = &sysctl_ieee_emulation_warnings,
  603. .maxlen = sizeof(int),
  604. .mode = 0644,
  605. .proc_handler = &proc_dointvec,
  606. },
  607. #endif
  608. {
  609. .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
  610. .procname = "userprocess_debug",
  611. .data = &sysctl_userprocess_debug,
  612. .maxlen = sizeof(int),
  613. .mode = 0644,
  614. .proc_handler = &proc_dointvec,
  615. },
  616. #endif
  617. {
  618. .ctl_name = KERN_PIDMAX,
  619. .procname = "pid_max",
  620. .data = &pid_max,
  621. .maxlen = sizeof (int),
  622. .mode = 0644,
  623. .proc_handler = &proc_dointvec_minmax,
  624. .strategy = sysctl_intvec,
  625. .extra1 = &pid_max_min,
  626. .extra2 = &pid_max_max,
  627. },
  628. {
  629. .ctl_name = KERN_PANIC_ON_OOPS,
  630. .procname = "panic_on_oops",
  631. .data = &panic_on_oops,
  632. .maxlen = sizeof(int),
  633. .mode = 0644,
  634. .proc_handler = &proc_dointvec,
  635. },
  636. #if defined CONFIG_PRINTK
  637. {
  638. .ctl_name = KERN_PRINTK,
  639. .procname = "printk",
  640. .data = &console_loglevel,
  641. .maxlen = 4*sizeof(int),
  642. .mode = 0644,
  643. .proc_handler = &proc_dointvec,
  644. },
  645. {
  646. .ctl_name = KERN_PRINTK_RATELIMIT,
  647. .procname = "printk_ratelimit",
  648. .data = &printk_ratelimit_state.interval,
  649. .maxlen = sizeof(int),
  650. .mode = 0644,
  651. .proc_handler = &proc_dointvec_jiffies,
  652. .strategy = &sysctl_jiffies,
  653. },
  654. {
  655. .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
  656. .procname = "printk_ratelimit_burst",
  657. .data = &printk_ratelimit_state.burst,
  658. .maxlen = sizeof(int),
  659. .mode = 0644,
  660. .proc_handler = &proc_dointvec,
  661. },
  662. #endif
  663. {
  664. .ctl_name = KERN_NGROUPS_MAX,
  665. .procname = "ngroups_max",
  666. .data = &ngroups_max,
  667. .maxlen = sizeof (int),
  668. .mode = 0444,
  669. .proc_handler = &proc_dointvec,
  670. },
  671. #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  672. {
  673. .ctl_name = KERN_UNKNOWN_NMI_PANIC,
  674. .procname = "unknown_nmi_panic",
  675. .data = &unknown_nmi_panic,
  676. .maxlen = sizeof (int),
  677. .mode = 0644,
  678. .proc_handler = &proc_dointvec,
  679. },
  680. {
  681. .procname = "nmi_watchdog",
  682. .data = &nmi_watchdog_enabled,
  683. .maxlen = sizeof (int),
  684. .mode = 0644,
  685. .proc_handler = &proc_nmi_enabled,
  686. },
  687. #endif
  688. #if defined(CONFIG_X86)
  689. {
  690. .ctl_name = KERN_PANIC_ON_NMI,
  691. .procname = "panic_on_unrecovered_nmi",
  692. .data = &panic_on_unrecovered_nmi,
  693. .maxlen = sizeof(int),
  694. .mode = 0644,
  695. .proc_handler = &proc_dointvec,
  696. },
  697. {
  698. .ctl_name = KERN_BOOTLOADER_TYPE,
  699. .procname = "bootloader_type",
  700. .data = &bootloader_type,
  701. .maxlen = sizeof (int),
  702. .mode = 0444,
  703. .proc_handler = &proc_dointvec,
  704. },
  705. {
  706. .ctl_name = CTL_UNNUMBERED,
  707. .procname = "kstack_depth_to_print",
  708. .data = &kstack_depth_to_print,
  709. .maxlen = sizeof(int),
  710. .mode = 0644,
  711. .proc_handler = &proc_dointvec,
  712. },
  713. {
  714. .ctl_name = CTL_UNNUMBERED,
  715. .procname = "io_delay_type",
  716. .data = &io_delay_type,
  717. .maxlen = sizeof(int),
  718. .mode = 0644,
  719. .proc_handler = &proc_dointvec,
  720. },
  721. #endif
  722. #if defined(CONFIG_MMU)
  723. {
  724. .ctl_name = KERN_RANDOMIZE,
  725. .procname = "randomize_va_space",
  726. .data = &randomize_va_space,
  727. .maxlen = sizeof(int),
  728. .mode = 0644,
  729. .proc_handler = &proc_dointvec,
  730. },
  731. #endif
  732. #if defined(CONFIG_S390) && defined(CONFIG_SMP)
  733. {
  734. .ctl_name = KERN_SPIN_RETRY,
  735. .procname = "spin_retry",
  736. .data = &spin_retry,
  737. .maxlen = sizeof (int),
  738. .mode = 0644,
  739. .proc_handler = &proc_dointvec,
  740. },
  741. #endif
  742. #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
  743. {
  744. .procname = "acpi_video_flags",
  745. .data = &acpi_realmode_flags,
  746. .maxlen = sizeof (unsigned long),
  747. .mode = 0644,
  748. .proc_handler = &proc_doulongvec_minmax,
  749. },
  750. #endif
  751. #ifdef CONFIG_IA64
  752. {
  753. .ctl_name = KERN_IA64_UNALIGNED,
  754. .procname = "ignore-unaligned-usertrap",
  755. .data = &no_unaligned_warning,
  756. .maxlen = sizeof (int),
  757. .mode = 0644,
  758. .proc_handler = &proc_dointvec,
  759. },
  760. {
  761. .ctl_name = CTL_UNNUMBERED,
  762. .procname = "unaligned-dump-stack",
  763. .data = &unaligned_dump_stack,
  764. .maxlen = sizeof (int),
  765. .mode = 0644,
  766. .proc_handler = &proc_dointvec,
  767. },
  768. #endif
  769. #ifdef CONFIG_DETECT_SOFTLOCKUP
  770. {
  771. .ctl_name = CTL_UNNUMBERED,
  772. .procname = "softlockup_panic",
  773. .data = &softlockup_panic,
  774. .maxlen = sizeof(int),
  775. .mode = 0644,
  776. .proc_handler = &proc_dointvec_minmax,
  777. .strategy = &sysctl_intvec,
  778. .extra1 = &zero,
  779. .extra2 = &one,
  780. },
  781. {
  782. .ctl_name = CTL_UNNUMBERED,
  783. .procname = "softlockup_thresh",
  784. .data = &softlockup_thresh,
  785. .maxlen = sizeof(int),
  786. .mode = 0644,
  787. .proc_handler = &proc_dosoftlockup_thresh,
  788. .strategy = &sysctl_intvec,
  789. .extra1 = &neg_one,
  790. .extra2 = &sixty,
  791. },
  792. #endif
  793. #ifdef CONFIG_DETECT_HUNG_TASK
  794. {
  795. .ctl_name = CTL_UNNUMBERED,
  796. .procname = "hung_task_panic",
  797. .data = &sysctl_hung_task_panic,
  798. .maxlen = sizeof(int),
  799. .mode = 0644,
  800. .proc_handler = &proc_dointvec_minmax,
  801. .strategy = &sysctl_intvec,
  802. .extra1 = &zero,
  803. .extra2 = &one,
  804. },
  805. {
  806. .ctl_name = CTL_UNNUMBERED,
  807. .procname = "hung_task_check_count",
  808. .data = &sysctl_hung_task_check_count,
  809. .maxlen = sizeof(unsigned long),
  810. .mode = 0644,
  811. .proc_handler = &proc_doulongvec_minmax,
  812. .strategy = &sysctl_intvec,
  813. },
  814. {
  815. .ctl_name = CTL_UNNUMBERED,
  816. .procname = "hung_task_timeout_secs",
  817. .data = &sysctl_hung_task_timeout_secs,
  818. .maxlen = sizeof(unsigned long),
  819. .mode = 0644,
  820. .proc_handler = &proc_dohung_task_timeout_secs,
  821. .strategy = &sysctl_intvec,
  822. },
  823. {
  824. .ctl_name = CTL_UNNUMBERED,
  825. .procname = "hung_task_warnings",
  826. .data = &sysctl_hung_task_warnings,
  827. .maxlen = sizeof(unsigned long),
  828. .mode = 0644,
  829. .proc_handler = &proc_doulongvec_minmax,
  830. .strategy = &sysctl_intvec,
  831. },
  832. #endif
  833. #ifdef CONFIG_COMPAT
  834. {
  835. .ctl_name = KERN_COMPAT_LOG,
  836. .procname = "compat-log",
  837. .data = &compat_log,
  838. .maxlen = sizeof (int),
  839. .mode = 0644,
  840. .proc_handler = &proc_dointvec,
  841. },
  842. #endif
  843. #ifdef CONFIG_RT_MUTEXES
  844. {
  845. .ctl_name = KERN_MAX_LOCK_DEPTH,
  846. .procname = "max_lock_depth",
  847. .data = &max_lock_depth,
  848. .maxlen = sizeof(int),
  849. .mode = 0644,
  850. .proc_handler = &proc_dointvec,
  851. },
  852. #endif
  853. {
  854. .ctl_name = CTL_UNNUMBERED,
  855. .procname = "poweroff_cmd",
  856. .data = &poweroff_cmd,
  857. .maxlen = POWEROFF_CMD_PATH_LEN,
  858. .mode = 0644,
  859. .proc_handler = &proc_dostring,
  860. .strategy = &sysctl_string,
  861. },
  862. #ifdef CONFIG_KEYS
  863. {
  864. .ctl_name = CTL_UNNUMBERED,
  865. .procname = "keys",
  866. .mode = 0555,
  867. .child = key_sysctls,
  868. },
  869. #endif
  870. #ifdef CONFIG_RCU_TORTURE_TEST
  871. {
  872. .ctl_name = CTL_UNNUMBERED,
  873. .procname = "rcutorture_runnable",
  874. .data = &rcutorture_runnable,
  875. .maxlen = sizeof(int),
  876. .mode = 0644,
  877. .proc_handler = &proc_dointvec,
  878. },
  879. #endif
  880. #ifdef CONFIG_SLOW_WORK
  881. {
  882. .ctl_name = CTL_UNNUMBERED,
  883. .procname = "slow-work",
  884. .mode = 0555,
  885. .child = slow_work_sysctls,
  886. },
  887. #endif
  888. /*
  889. * NOTE: do not add new entries to this table unless you have read
  890. * Documentation/sysctl/ctl_unnumbered.txt
  891. */
  892. { .ctl_name = 0 }
  893. };
  894. static struct ctl_table vm_table[] = {
  895. {
  896. .ctl_name = VM_OVERCOMMIT_MEMORY,
  897. .procname = "overcommit_memory",
  898. .data = &sysctl_overcommit_memory,
  899. .maxlen = sizeof(sysctl_overcommit_memory),
  900. .mode = 0644,
  901. .proc_handler = &proc_dointvec,
  902. },
  903. {
  904. .ctl_name = VM_PANIC_ON_OOM,
  905. .procname = "panic_on_oom",
  906. .data = &sysctl_panic_on_oom,
  907. .maxlen = sizeof(sysctl_panic_on_oom),
  908. .mode = 0644,
  909. .proc_handler = &proc_dointvec,
  910. },
  911. {
  912. .ctl_name = CTL_UNNUMBERED,
  913. .procname = "oom_kill_allocating_task",
  914. .data = &sysctl_oom_kill_allocating_task,
  915. .maxlen = sizeof(sysctl_oom_kill_allocating_task),
  916. .mode = 0644,
  917. .proc_handler = &proc_dointvec,
  918. },
  919. {
  920. .ctl_name = CTL_UNNUMBERED,
  921. .procname = "oom_dump_tasks",
  922. .data = &sysctl_oom_dump_tasks,
  923. .maxlen = sizeof(sysctl_oom_dump_tasks),
  924. .mode = 0644,
  925. .proc_handler = &proc_dointvec,
  926. },
  927. {
  928. .ctl_name = VM_OVERCOMMIT_RATIO,
  929. .procname = "overcommit_ratio",
  930. .data = &sysctl_overcommit_ratio,
  931. .maxlen = sizeof(sysctl_overcommit_ratio),
  932. .mode = 0644,
  933. .proc_handler = &proc_dointvec,
  934. },
  935. {
  936. .ctl_name = VM_PAGE_CLUSTER,
  937. .procname = "page-cluster",
  938. .data = &page_cluster,
  939. .maxlen = sizeof(int),
  940. .mode = 0644,
  941. .proc_handler = &proc_dointvec,
  942. },
  943. {
  944. .ctl_name = VM_DIRTY_BACKGROUND,
  945. .procname = "dirty_background_ratio",
  946. .data = &dirty_background_ratio,
  947. .maxlen = sizeof(dirty_background_ratio),
  948. .mode = 0644,
  949. .proc_handler = &dirty_background_ratio_handler,
  950. .strategy = &sysctl_intvec,
  951. .extra1 = &zero,
  952. .extra2 = &one_hundred,
  953. },
  954. {
  955. .ctl_name = CTL_UNNUMBERED,
  956. .procname = "dirty_background_bytes",
  957. .data = &dirty_background_bytes,
  958. .maxlen = sizeof(dirty_background_bytes),
  959. .mode = 0644,
  960. .proc_handler = &dirty_background_bytes_handler,
  961. .strategy = &sysctl_intvec,
  962. .extra1 = &one_ul,
  963. },
  964. {
  965. .ctl_name = VM_DIRTY_RATIO,
  966. .procname = "dirty_ratio",
  967. .data = &vm_dirty_ratio,
  968. .maxlen = sizeof(vm_dirty_ratio),
  969. .mode = 0644,
  970. .proc_handler = &dirty_ratio_handler,
  971. .strategy = &sysctl_intvec,
  972. .extra1 = &zero,
  973. .extra2 = &one_hundred,
  974. },
  975. {
  976. .ctl_name = CTL_UNNUMBERED,
  977. .procname = "dirty_bytes",
  978. .data = &vm_dirty_bytes,
  979. .maxlen = sizeof(vm_dirty_bytes),
  980. .mode = 0644,
  981. .proc_handler = &dirty_bytes_handler,
  982. .strategy = &sysctl_intvec,
  983. .extra1 = &dirty_bytes_min,
  984. },
  985. {
  986. .procname = "dirty_writeback_centisecs",
  987. .data = &dirty_writeback_interval,
  988. .maxlen = sizeof(dirty_writeback_interval),
  989. .mode = 0644,
  990. .proc_handler = &dirty_writeback_centisecs_handler,
  991. },
  992. {
  993. .procname = "dirty_expire_centisecs",
  994. .data = &dirty_expire_interval,
  995. .maxlen = sizeof(dirty_expire_interval),
  996. .mode = 0644,
  997. .proc_handler = &proc_dointvec,
  998. },
  999. {
  1000. .ctl_name = VM_NR_PDFLUSH_THREADS,
  1001. .procname = "nr_pdflush_threads",
  1002. .data = &nr_pdflush_threads,
  1003. .maxlen = sizeof nr_pdflush_threads,
  1004. .mode = 0444 /* read-only*/,
  1005. .proc_handler = &proc_dointvec,
  1006. },
  1007. {
  1008. .ctl_name = CTL_UNNUMBERED,
  1009. .procname = "nr_pdflush_threads_min",
  1010. .data = &nr_pdflush_threads_min,
  1011. .maxlen = sizeof nr_pdflush_threads_min,
  1012. .mode = 0644 /* read-write */,
  1013. .proc_handler = &proc_dointvec_minmax,
  1014. .strategy = &sysctl_intvec,
  1015. .extra1 = &one,
  1016. .extra2 = &nr_pdflush_threads_max,
  1017. },
  1018. {
  1019. .ctl_name = CTL_UNNUMBERED,
  1020. .procname = "nr_pdflush_threads_max",
  1021. .data = &nr_pdflush_threads_max,
  1022. .maxlen = sizeof nr_pdflush_threads_max,
  1023. .mode = 0644 /* read-write */,
  1024. .proc_handler = &proc_dointvec_minmax,
  1025. .strategy = &sysctl_intvec,
  1026. .extra1 = &nr_pdflush_threads_min,
  1027. .extra2 = &one_thousand,
  1028. },
  1029. {
  1030. .ctl_name = VM_SWAPPINESS,
  1031. .procname = "swappiness",
  1032. .data = &vm_swappiness,
  1033. .maxlen = sizeof(vm_swappiness),
  1034. .mode = 0644,
  1035. .proc_handler = &proc_dointvec_minmax,
  1036. .strategy = &sysctl_intvec,
  1037. .extra1 = &zero,
  1038. .extra2 = &one_hundred,
  1039. },
  1040. #ifdef CONFIG_HUGETLB_PAGE
  1041. {
  1042. .procname = "nr_hugepages",
  1043. .data = NULL,
  1044. .maxlen = sizeof(unsigned long),
  1045. .mode = 0644,
  1046. .proc_handler = &hugetlb_sysctl_handler,
  1047. .extra1 = (void *)&hugetlb_zero,
  1048. .extra2 = (void *)&hugetlb_infinity,
  1049. },
  1050. {
  1051. .ctl_name = VM_HUGETLB_GROUP,
  1052. .procname = "hugetlb_shm_group",
  1053. .data = &sysctl_hugetlb_shm_group,
  1054. .maxlen = sizeof(gid_t),
  1055. .mode = 0644,
  1056. .proc_handler = &proc_dointvec,
  1057. },
  1058. {
  1059. .ctl_name = CTL_UNNUMBERED,
  1060. .procname = "hugepages_treat_as_movable",
  1061. .data = &hugepages_treat_as_movable,
  1062. .maxlen = sizeof(int),
  1063. .mode = 0644,
  1064. .proc_handler = &hugetlb_treat_movable_handler,
  1065. },
  1066. {
  1067. .ctl_name = CTL_UNNUMBERED,
  1068. .procname = "nr_overcommit_hugepages",
  1069. .data = NULL,
  1070. .maxlen = sizeof(unsigned long),
  1071. .mode = 0644,
  1072. .proc_handler = &hugetlb_overcommit_handler,
  1073. .extra1 = (void *)&hugetlb_zero,
  1074. .extra2 = (void *)&hugetlb_infinity,
  1075. },
  1076. #endif
  1077. {
  1078. .ctl_name = VM_LOWMEM_RESERVE_RATIO,
  1079. .procname = "lowmem_reserve_ratio",
  1080. .data = &sysctl_lowmem_reserve_ratio,
  1081. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  1082. .mode = 0644,
  1083. .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
  1084. .strategy = &sysctl_intvec,
  1085. },
  1086. {
  1087. .ctl_name = VM_DROP_PAGECACHE,
  1088. .procname = "drop_caches",
  1089. .data = &sysctl_drop_caches,
  1090. .maxlen = sizeof(int),
  1091. .mode = 0644,
  1092. .proc_handler = drop_caches_sysctl_handler,
  1093. .strategy = &sysctl_intvec,
  1094. },
  1095. {
  1096. .ctl_name = VM_MIN_FREE_KBYTES,
  1097. .procname = "min_free_kbytes",
  1098. .data = &min_free_kbytes,
  1099. .maxlen = sizeof(min_free_kbytes),
  1100. .mode = 0644,
  1101. .proc_handler = &min_free_kbytes_sysctl_handler,
  1102. .strategy = &sysctl_intvec,
  1103. .extra1 = &zero,
  1104. },
  1105. {
  1106. .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
  1107. .procname = "percpu_pagelist_fraction",
  1108. .data = &percpu_pagelist_fraction,
  1109. .maxlen = sizeof(percpu_pagelist_fraction),
  1110. .mode = 0644,
  1111. .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
  1112. .strategy = &sysctl_intvec,
  1113. .extra1 = &min_percpu_pagelist_fract,
  1114. },
  1115. #ifdef CONFIG_MMU
  1116. {
  1117. .ctl_name = VM_MAX_MAP_COUNT,
  1118. .procname = "max_map_count",
  1119. .data = &sysctl_max_map_count,
  1120. .maxlen = sizeof(sysctl_max_map_count),
  1121. .mode = 0644,
  1122. .proc_handler = &proc_dointvec
  1123. },
  1124. #else
  1125. {
  1126. .ctl_name = CTL_UNNUMBERED,
  1127. .procname = "nr_trim_pages",
  1128. .data = &sysctl_nr_trim_pages,
  1129. .maxlen = sizeof(sysctl_nr_trim_pages),
  1130. .mode = 0644,
  1131. .proc_handler = &proc_dointvec_minmax,
  1132. .strategy = &sysctl_intvec,
  1133. .extra1 = &zero,
  1134. },
  1135. #endif
  1136. {
  1137. .ctl_name = VM_LAPTOP_MODE,
  1138. .procname = "laptop_mode",
  1139. .data = &laptop_mode,
  1140. .maxlen = sizeof(laptop_mode),
  1141. .mode = 0644,
  1142. .proc_handler = &proc_dointvec_jiffies,
  1143. .strategy = &sysctl_jiffies,
  1144. },
  1145. {
  1146. .ctl_name = VM_BLOCK_DUMP,
  1147. .procname = "block_dump",
  1148. .data = &block_dump,
  1149. .maxlen = sizeof(block_dump),
  1150. .mode = 0644,
  1151. .proc_handler = &proc_dointvec,
  1152. .strategy = &sysctl_intvec,
  1153. .extra1 = &zero,
  1154. },
  1155. {
  1156. .ctl_name = VM_VFS_CACHE_PRESSURE,
  1157. .procname = "vfs_cache_pressure",
  1158. .data = &sysctl_vfs_cache_pressure,
  1159. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  1160. .mode = 0644,
  1161. .proc_handler = &proc_dointvec,
  1162. .strategy = &sysctl_intvec,
  1163. .extra1 = &zero,
  1164. },
  1165. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  1166. {
  1167. .ctl_name = VM_LEGACY_VA_LAYOUT,
  1168. .procname = "legacy_va_layout",
  1169. .data = &sysctl_legacy_va_layout,
  1170. .maxlen = sizeof(sysctl_legacy_va_layout),
  1171. .mode = 0644,
  1172. .proc_handler = &proc_dointvec,
  1173. .strategy = &sysctl_intvec,
  1174. .extra1 = &zero,
  1175. },
  1176. #endif
  1177. #ifdef CONFIG_NUMA
  1178. {
  1179. .ctl_name = VM_ZONE_RECLAIM_MODE,
  1180. .procname = "zone_reclaim_mode",
  1181. .data = &zone_reclaim_mode,
  1182. .maxlen = sizeof(zone_reclaim_mode),
  1183. .mode = 0644,
  1184. .proc_handler = &proc_dointvec,
  1185. .strategy = &sysctl_intvec,
  1186. .extra1 = &zero,
  1187. },
  1188. {
  1189. .ctl_name = VM_MIN_UNMAPPED,
  1190. .procname = "min_unmapped_ratio",
  1191. .data = &sysctl_min_unmapped_ratio,
  1192. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  1193. .mode = 0644,
  1194. .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
  1195. .strategy = &sysctl_intvec,
  1196. .extra1 = &zero,
  1197. .extra2 = &one_hundred,
  1198. },
  1199. {
  1200. .ctl_name = VM_MIN_SLAB,
  1201. .procname = "min_slab_ratio",
  1202. .data = &sysctl_min_slab_ratio,
  1203. .maxlen = sizeof(sysctl_min_slab_ratio),
  1204. .mode = 0644,
  1205. .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
  1206. .strategy = &sysctl_intvec,
  1207. .extra1 = &zero,
  1208. .extra2 = &one_hundred,
  1209. },
  1210. #endif
  1211. #ifdef CONFIG_SMP
  1212. {
  1213. .ctl_name = CTL_UNNUMBERED,
  1214. .procname = "stat_interval",
  1215. .data = &sysctl_stat_interval,
  1216. .maxlen = sizeof(sysctl_stat_interval),
  1217. .mode = 0644,
  1218. .proc_handler = &proc_dointvec_jiffies,
  1219. .strategy = &sysctl_jiffies,
  1220. },
  1221. #endif
  1222. #ifdef CONFIG_SECURITY
  1223. {
  1224. .ctl_name = CTL_UNNUMBERED,
  1225. .procname = "mmap_min_addr",
  1226. .data = &mmap_min_addr,
  1227. .maxlen = sizeof(unsigned long),
  1228. .mode = 0644,
  1229. .proc_handler = &proc_doulongvec_minmax,
  1230. },
  1231. #endif
  1232. #ifdef CONFIG_NUMA
  1233. {
  1234. .ctl_name = CTL_UNNUMBERED,
  1235. .procname = "numa_zonelist_order",
  1236. .data = &numa_zonelist_order,
  1237. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  1238. .mode = 0644,
  1239. .proc_handler = &numa_zonelist_order_handler,
  1240. .strategy = &sysctl_string,
  1241. },
  1242. #endif
  1243. #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
  1244. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  1245. {
  1246. .ctl_name = VM_VDSO_ENABLED,
  1247. .procname = "vdso_enabled",
  1248. .data = &vdso_enabled,
  1249. .maxlen = sizeof(vdso_enabled),
  1250. .mode = 0644,
  1251. .proc_handler = &proc_dointvec,
  1252. .strategy = &sysctl_intvec,
  1253. .extra1 = &zero,
  1254. },
  1255. #endif
  1256. #ifdef CONFIG_HIGHMEM
  1257. {
  1258. .ctl_name = CTL_UNNUMBERED,
  1259. .procname = "highmem_is_dirtyable",
  1260. .data = &vm_highmem_is_dirtyable,
  1261. .maxlen = sizeof(vm_highmem_is_dirtyable),
  1262. .mode = 0644,
  1263. .proc_handler = &proc_dointvec_minmax,
  1264. .strategy = &sysctl_intvec,
  1265. .extra1 = &zero,
  1266. .extra2 = &one,
  1267. },
  1268. #endif
  1269. #ifdef CONFIG_UNEVICTABLE_LRU
  1270. {
  1271. .ctl_name = CTL_UNNUMBERED,
  1272. .procname = "scan_unevictable_pages",
  1273. .data = &scan_unevictable_pages,
  1274. .maxlen = sizeof(scan_unevictable_pages),
  1275. .mode = 0644,
  1276. .proc_handler = &scan_unevictable_handler,
  1277. },
  1278. #endif
  1279. /*
  1280. * NOTE: do not add new entries to this table unless you have read
  1281. * Documentation/sysctl/ctl_unnumbered.txt
  1282. */
  1283. { .ctl_name = 0 }
  1284. };
  1285. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1286. static struct ctl_table binfmt_misc_table[] = {
  1287. { .ctl_name = 0 }
  1288. };
  1289. #endif
  1290. static struct ctl_table fs_table[] = {
  1291. {
  1292. .ctl_name = FS_NRINODE,
  1293. .procname = "inode-nr",
  1294. .data = &inodes_stat,
  1295. .maxlen = 2*sizeof(int),
  1296. .mode = 0444,
  1297. .proc_handler = &proc_dointvec,
  1298. },
  1299. {
  1300. .ctl_name = FS_STATINODE,
  1301. .procname = "inode-state",
  1302. .data = &inodes_stat,
  1303. .maxlen = 7*sizeof(int),
  1304. .mode = 0444,
  1305. .proc_handler = &proc_dointvec,
  1306. },
  1307. {
  1308. .procname = "file-nr",
  1309. .data = &files_stat,
  1310. .maxlen = 3*sizeof(int),
  1311. .mode = 0444,
  1312. .proc_handler = &proc_nr_files,
  1313. },
  1314. {
  1315. .ctl_name = FS_MAXFILE,
  1316. .procname = "file-max",
  1317. .data = &files_stat.max_files,
  1318. .maxlen = sizeof(int),
  1319. .mode = 0644,
  1320. .proc_handler = &proc_dointvec,
  1321. },
  1322. {
  1323. .ctl_name = CTL_UNNUMBERED,
  1324. .procname = "nr_open",
  1325. .data = &sysctl_nr_open,
  1326. .maxlen = sizeof(int),
  1327. .mode = 0644,
  1328. .proc_handler = &proc_dointvec_minmax,
  1329. .extra1 = &sysctl_nr_open_min,
  1330. .extra2 = &sysctl_nr_open_max,
  1331. },
  1332. {
  1333. .ctl_name = FS_DENTRY,
  1334. .procname = "dentry-state",
  1335. .data = &dentry_stat,
  1336. .maxlen = 6*sizeof(int),
  1337. .mode = 0444,
  1338. .proc_handler = &proc_dointvec,
  1339. },
  1340. {
  1341. .ctl_name = FS_OVERFLOWUID,
  1342. .procname = "overflowuid",
  1343. .data = &fs_overflowuid,
  1344. .maxlen = sizeof(int),
  1345. .mode = 0644,
  1346. .proc_handler = &proc_dointvec_minmax,
  1347. .strategy = &sysctl_intvec,
  1348. .extra1 = &minolduid,
  1349. .extra2 = &maxolduid,
  1350. },
  1351. {
  1352. .ctl_name = FS_OVERFLOWGID,
  1353. .procname = "overflowgid",
  1354. .data = &fs_overflowgid,
  1355. .maxlen = sizeof(int),
  1356. .mode = 0644,
  1357. .proc_handler = &proc_dointvec_minmax,
  1358. .strategy = &sysctl_intvec,
  1359. .extra1 = &minolduid,
  1360. .extra2 = &maxolduid,
  1361. },
  1362. #ifdef CONFIG_FILE_LOCKING
  1363. {
  1364. .ctl_name = FS_LEASES,
  1365. .procname = "leases-enable",
  1366. .data = &leases_enable,
  1367. .maxlen = sizeof(int),
  1368. .mode = 0644,
  1369. .proc_handler = &proc_dointvec,
  1370. },
  1371. #endif
  1372. #ifdef CONFIG_DNOTIFY
  1373. {
  1374. .ctl_name = FS_DIR_NOTIFY,
  1375. .procname = "dir-notify-enable",
  1376. .data = &dir_notify_enable,
  1377. .maxlen = sizeof(int),
  1378. .mode = 0644,
  1379. .proc_handler = &proc_dointvec,
  1380. },
  1381. #endif
  1382. #ifdef CONFIG_MMU
  1383. #ifdef CONFIG_FILE_LOCKING
  1384. {
  1385. .ctl_name = FS_LEASE_TIME,
  1386. .procname = "lease-break-time",
  1387. .data = &lease_break_time,
  1388. .maxlen = sizeof(int),
  1389. .mode = 0644,
  1390. .proc_handler = &proc_dointvec,
  1391. },
  1392. #endif
  1393. #ifdef CONFIG_AIO
  1394. {
  1395. .procname = "aio-nr",
  1396. .data = &aio_nr,
  1397. .maxlen = sizeof(aio_nr),
  1398. .mode = 0444,
  1399. .proc_handler = &proc_doulongvec_minmax,
  1400. },
  1401. {
  1402. .procname = "aio-max-nr",
  1403. .data = &aio_max_nr,
  1404. .maxlen = sizeof(aio_max_nr),
  1405. .mode = 0644,
  1406. .proc_handler = &proc_doulongvec_minmax,
  1407. },
  1408. #endif /* CONFIG_AIO */
  1409. #ifdef CONFIG_INOTIFY_USER
  1410. {
  1411. .ctl_name = FS_INOTIFY,
  1412. .procname = "inotify",
  1413. .mode = 0555,
  1414. .child = inotify_table,
  1415. },
  1416. #endif
  1417. #ifdef CONFIG_EPOLL
  1418. {
  1419. .procname = "epoll",
  1420. .mode = 0555,
  1421. .child = epoll_table,
  1422. },
  1423. #endif
  1424. #endif
  1425. {
  1426. .ctl_name = KERN_SETUID_DUMPABLE,
  1427. .procname = "suid_dumpable",
  1428. .data = &suid_dumpable,
  1429. .maxlen = sizeof(int),
  1430. .mode = 0644,
  1431. .proc_handler = &proc_dointvec_minmax,
  1432. .strategy = &sysctl_intvec,
  1433. .extra1 = &zero,
  1434. .extra2 = &two,
  1435. },
  1436. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1437. {
  1438. .ctl_name = CTL_UNNUMBERED,
  1439. .procname = "binfmt_misc",
  1440. .mode = 0555,
  1441. .child = binfmt_misc_table,
  1442. },
  1443. #endif
  1444. /*
  1445. * NOTE: do not add new entries to this table unless you have read
  1446. * Documentation/sysctl/ctl_unnumbered.txt
  1447. */
  1448. { .ctl_name = 0 }
  1449. };
  1450. static struct ctl_table debug_table[] = {
  1451. #if defined(CONFIG_X86) || defined(CONFIG_PPC)
  1452. {
  1453. .ctl_name = CTL_UNNUMBERED,
  1454. .procname = "exception-trace",
  1455. .data = &show_unhandled_signals,
  1456. .maxlen = sizeof(int),
  1457. .mode = 0644,
  1458. .proc_handler = proc_dointvec
  1459. },
  1460. #endif
  1461. { .ctl_name = 0 }
  1462. };
  1463. static struct ctl_table dev_table[] = {
  1464. { .ctl_name = 0 }
  1465. };
  1466. static DEFINE_SPINLOCK(sysctl_lock);
  1467. /* called under sysctl_lock */
  1468. static int use_table(struct ctl_table_header *p)
  1469. {
  1470. if (unlikely(p->unregistering))
  1471. return 0;
  1472. p->used++;
  1473. return 1;
  1474. }
  1475. /* called under sysctl_lock */
  1476. static void unuse_table(struct ctl_table_header *p)
  1477. {
  1478. if (!--p->used)
  1479. if (unlikely(p->unregistering))
  1480. complete(p->unregistering);
  1481. }
  1482. /* called under sysctl_lock, will reacquire if has to wait */
  1483. static void start_unregistering(struct ctl_table_header *p)
  1484. {
  1485. /*
  1486. * if p->used is 0, nobody will ever touch that entry again;
  1487. * we'll eliminate all paths to it before dropping sysctl_lock
  1488. */
  1489. if (unlikely(p->used)) {
  1490. struct completion wait;
  1491. init_completion(&wait);
  1492. p->unregistering = &wait;
  1493. spin_unlock(&sysctl_lock);
  1494. wait_for_completion(&wait);
  1495. spin_lock(&sysctl_lock);
  1496. } else {
  1497. /* anything non-NULL; we'll never dereference it */
  1498. p->unregistering = ERR_PTR(-EINVAL);
  1499. }
  1500. /*
  1501. * do not remove from the list until nobody holds it; walking the
  1502. * list in do_sysctl() relies on that.
  1503. */
  1504. list_del_init(&p->ctl_entry);
  1505. }
  1506. void sysctl_head_get(struct ctl_table_header *head)
  1507. {
  1508. spin_lock(&sysctl_lock);
  1509. head->count++;
  1510. spin_unlock(&sysctl_lock);
  1511. }
  1512. void sysctl_head_put(struct ctl_table_header *head)
  1513. {
  1514. spin_lock(&sysctl_lock);
  1515. if (!--head->count)
  1516. kfree(head);
  1517. spin_unlock(&sysctl_lock);
  1518. }
  1519. struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
  1520. {
  1521. if (!head)
  1522. BUG();
  1523. spin_lock(&sysctl_lock);
  1524. if (!use_table(head))
  1525. head = ERR_PTR(-ENOENT);
  1526. spin_unlock(&sysctl_lock);
  1527. return head;
  1528. }
  1529. void sysctl_head_finish(struct ctl_table_header *head)
  1530. {
  1531. if (!head)
  1532. return;
  1533. spin_lock(&sysctl_lock);
  1534. unuse_table(head);
  1535. spin_unlock(&sysctl_lock);
  1536. }
  1537. static struct ctl_table_set *
  1538. lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
  1539. {
  1540. struct ctl_table_set *set = &root->default_set;
  1541. if (root->lookup)
  1542. set = root->lookup(root, namespaces);
  1543. return set;
  1544. }
  1545. static struct list_head *
  1546. lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
  1547. {
  1548. struct ctl_table_set *set = lookup_header_set(root, namespaces);
  1549. return &set->list;
  1550. }
  1551. struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
  1552. struct ctl_table_header *prev)
  1553. {
  1554. struct ctl_table_root *root;
  1555. struct list_head *header_list;
  1556. struct ctl_table_header *head;
  1557. struct list_head *tmp;
  1558. spin_lock(&sysctl_lock);
  1559. if (prev) {
  1560. head = prev;
  1561. tmp = &prev->ctl_entry;
  1562. unuse_table(prev);
  1563. goto next;
  1564. }
  1565. tmp = &root_table_header.ctl_entry;
  1566. for (;;) {
  1567. head = list_entry(tmp, struct ctl_table_header, ctl_entry);
  1568. if (!use_table(head))
  1569. goto next;
  1570. spin_unlock(&sysctl_lock);
  1571. return head;
  1572. next:
  1573. root = head->root;
  1574. tmp = tmp->next;
  1575. header_list = lookup_header_list(root, namespaces);
  1576. if (tmp != header_list)
  1577. continue;
  1578. do {
  1579. root = list_entry(root->root_list.next,
  1580. struct ctl_table_root, root_list);
  1581. if (root == &sysctl_table_root)
  1582. goto out;
  1583. header_list = lookup_header_list(root, namespaces);
  1584. } while (list_empty(header_list));
  1585. tmp = header_list->next;
  1586. }
  1587. out:
  1588. spin_unlock(&sysctl_lock);
  1589. return NULL;
  1590. }
  1591. struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
  1592. {
  1593. return __sysctl_head_next(current->nsproxy, prev);
  1594. }
  1595. void register_sysctl_root(struct ctl_table_root *root)
  1596. {
  1597. spin_lock(&sysctl_lock);
  1598. list_add_tail(&root->root_list, &sysctl_table_root.root_list);
  1599. spin_unlock(&sysctl_lock);
  1600. }
  1601. #ifdef CONFIG_SYSCTL_SYSCALL
  1602. /* Perform the actual read/write of a sysctl table entry. */
  1603. static int do_sysctl_strategy(struct ctl_table_root *root,
  1604. struct ctl_table *table,
  1605. void __user *oldval, size_t __user *oldlenp,
  1606. void __user *newval, size_t newlen)
  1607. {
  1608. int op = 0, rc;
  1609. if (oldval)
  1610. op |= MAY_READ;
  1611. if (newval)
  1612. op |= MAY_WRITE;
  1613. if (sysctl_perm(root, table, op))
  1614. return -EPERM;
  1615. if (table->strategy) {
  1616. rc = table->strategy(table, oldval, oldlenp, newval, newlen);
  1617. if (rc < 0)
  1618. return rc;
  1619. if (rc > 0)
  1620. return 0;
  1621. }
  1622. /* If there is no strategy routine, or if the strategy returns
  1623. * zero, proceed with automatic r/w */
  1624. if (table->data && table->maxlen) {
  1625. rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
  1626. if (rc < 0)
  1627. return rc;
  1628. }
  1629. return 0;
  1630. }
  1631. static int parse_table(int __user *name, int nlen,
  1632. void __user *oldval, size_t __user *oldlenp,
  1633. void __user *newval, size_t newlen,
  1634. struct ctl_table_root *root,
  1635. struct ctl_table *table)
  1636. {
  1637. int n;
  1638. repeat:
  1639. if (!nlen)
  1640. return -ENOTDIR;
  1641. if (get_user(n, name))
  1642. return -EFAULT;
  1643. for ( ; table->ctl_name || table->procname; table++) {
  1644. if (!table->ctl_name)
  1645. continue;
  1646. if (n == table->ctl_name) {
  1647. int error;
  1648. if (table->child) {
  1649. if (sysctl_perm(root, table, MAY_EXEC))
  1650. return -EPERM;
  1651. name++;
  1652. nlen--;
  1653. table = table->child;
  1654. goto repeat;
  1655. }
  1656. error = do_sysctl_strategy(root, table,
  1657. oldval, oldlenp,
  1658. newval, newlen);
  1659. return error;
  1660. }
  1661. }
  1662. return -ENOTDIR;
  1663. }
  1664. int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
  1665. void __user *newval, size_t newlen)
  1666. {
  1667. struct ctl_table_header *head;
  1668. int error = -ENOTDIR;
  1669. if (nlen <= 0 || nlen >= CTL_MAXNAME)
  1670. return -ENOTDIR;
  1671. if (oldval) {
  1672. int old_len;
  1673. if (!oldlenp || get_user(old_len, oldlenp))
  1674. return -EFAULT;
  1675. }
  1676. for (head = sysctl_head_next(NULL); head;
  1677. head = sysctl_head_next(head)) {
  1678. error = parse_table(name, nlen, oldval, oldlenp,
  1679. newval, newlen,
  1680. head->root, head->ctl_table);
  1681. if (error != -ENOTDIR) {
  1682. sysctl_head_finish(head);
  1683. break;
  1684. }
  1685. }
  1686. return error;
  1687. }
  1688. SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
  1689. {
  1690. struct __sysctl_args tmp;
  1691. int error;
  1692. if (copy_from_user(&tmp, args, sizeof(tmp)))
  1693. return -EFAULT;
  1694. error = deprecated_sysctl_warning(&tmp);
  1695. if (error)
  1696. goto out;
  1697. lock_kernel();
  1698. error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
  1699. tmp.newval, tmp.newlen);
  1700. unlock_kernel();
  1701. out:
  1702. return error;
  1703. }
  1704. #endif /* CONFIG_SYSCTL_SYSCALL */
  1705. /*
  1706. * sysctl_perm does NOT grant the superuser all rights automatically, because
  1707. * some sysctl variables are readonly even to root.
  1708. */
  1709. static int test_perm(int mode, int op)
  1710. {
  1711. if (!current_euid())
  1712. mode >>= 6;
  1713. else if (in_egroup_p(0))
  1714. mode >>= 3;
  1715. if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
  1716. return 0;
  1717. return -EACCES;
  1718. }
  1719. int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
  1720. {
  1721. int error;
  1722. int mode;
  1723. error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
  1724. if (error)
  1725. return error;
  1726. if (root->permissions)
  1727. mode = root->permissions(root, current->nsproxy, table);
  1728. else
  1729. mode = table->mode;
  1730. return test_perm(mode, op);
  1731. }
  1732. static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
  1733. {
  1734. for (; table->ctl_name || table->procname; table++) {
  1735. table->parent = parent;
  1736. if (table->child)
  1737. sysctl_set_parent(table, table->child);
  1738. }
  1739. }
  1740. static __init int sysctl_init(void)
  1741. {
  1742. sysctl_set_parent(NULL, root_table);
  1743. #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
  1744. {
  1745. int err;
  1746. err = sysctl_check_table(current->nsproxy, root_table);
  1747. }
  1748. #endif
  1749. return 0;
  1750. }
  1751. core_initcall(sysctl_init);
  1752. static struct ctl_table *is_branch_in(struct ctl_table *branch,
  1753. struct ctl_table *table)
  1754. {
  1755. struct ctl_table *p;
  1756. const char *s = branch->procname;
  1757. /* branch should have named subdirectory as its first element */
  1758. if (!s || !branch->child)
  1759. return NULL;
  1760. /* ... and nothing else */
  1761. if (branch[1].procname || branch[1].ctl_name)
  1762. return NULL;
  1763. /* table should contain subdirectory with the same name */
  1764. for (p = table; p->procname || p->ctl_name; p++) {
  1765. if (!p->child)
  1766. continue;
  1767. if (p->procname && strcmp(p->procname, s) == 0)
  1768. return p;
  1769. }
  1770. return NULL;
  1771. }
  1772. /* see if attaching q to p would be an improvement */
  1773. static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
  1774. {
  1775. struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
  1776. struct ctl_table *next;
  1777. int is_better = 0;
  1778. int not_in_parent = !p->attached_by;
  1779. while ((next = is_branch_in(by, to)) != NULL) {
  1780. if (by == q->attached_by)
  1781. is_better = 1;
  1782. if (to == p->attached_by)
  1783. not_in_parent = 1;
  1784. by = by->child;
  1785. to = next->child;
  1786. }
  1787. if (is_better && not_in_parent) {
  1788. q->attached_by = by;
  1789. q->attached_to = to;
  1790. q->parent = p;
  1791. }
  1792. }
  1793. /**
  1794. * __register_sysctl_paths - register a sysctl hierarchy
  1795. * @root: List of sysctl headers to register on
  1796. * @namespaces: Data to compute which lists of sysctl entries are visible
  1797. * @path: The path to the directory the sysctl table is in.
  1798. * @table: the top-level table structure
  1799. *
  1800. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1801. * array. A completely 0 filled entry terminates the table.
  1802. *
  1803. * The members of the &struct ctl_table structure are used as follows:
  1804. *
  1805. * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
  1806. * must be unique within that level of sysctl
  1807. *
  1808. * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
  1809. * enter a sysctl file
  1810. *
  1811. * data - a pointer to data for use by proc_handler
  1812. *
  1813. * maxlen - the maximum size in bytes of the data
  1814. *
  1815. * mode - the file permissions for the /proc/sys file, and for sysctl(2)
  1816. *
  1817. * child - a pointer to the child sysctl table if this entry is a directory, or
  1818. * %NULL.
  1819. *
  1820. * proc_handler - the text handler routine (described below)
  1821. *
  1822. * strategy - the strategy routine (described below)
  1823. *
  1824. * de - for internal use by the sysctl routines
  1825. *
  1826. * extra1, extra2 - extra pointers usable by the proc handler routines
  1827. *
  1828. * Leaf nodes in the sysctl tree will be represented by a single file
  1829. * under /proc; non-leaf nodes will be represented by directories.
  1830. *
  1831. * sysctl(2) can automatically manage read and write requests through
  1832. * the sysctl table. The data and maxlen fields of the ctl_table
  1833. * struct enable minimal validation of the values being written to be
  1834. * performed, and the mode field allows minimal authentication.
  1835. *
  1836. * More sophisticated management can be enabled by the provision of a
  1837. * strategy routine with the table entry. This will be called before
  1838. * any automatic read or write of the data is performed.
  1839. *
  1840. * The strategy routine may return
  1841. *
  1842. * < 0 - Error occurred (error is passed to user process)
  1843. *
  1844. * 0 - OK - proceed with automatic read or write.
  1845. *
  1846. * > 0 - OK - read or write has been done by the strategy routine, so
  1847. * return immediately.
  1848. *
  1849. * There must be a proc_handler routine for any terminal nodes
  1850. * mirrored under /proc/sys (non-terminals are handled by a built-in
  1851. * directory handler). Several default handlers are available to
  1852. * cover common cases -
  1853. *
  1854. * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
  1855. * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
  1856. * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
  1857. *
  1858. * It is the handler's job to read the input buffer from user memory
  1859. * and process it. The handler should return 0 on success.
  1860. *
  1861. * This routine returns %NULL on a failure to register, and a pointer
  1862. * to the table header on success.
  1863. */
  1864. struct ctl_table_header *__register_sysctl_paths(
  1865. struct ctl_table_root *root,
  1866. struct nsproxy *namespaces,
  1867. const struct ctl_path *path, struct ctl_table *table)
  1868. {
  1869. struct ctl_table_header *header;
  1870. struct ctl_table *new, **prevp;
  1871. unsigned int n, npath;
  1872. struct ctl_table_set *set;
  1873. /* Count the path components */
  1874. for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
  1875. ;
  1876. /*
  1877. * For each path component, allocate a 2-element ctl_table array.
  1878. * The first array element will be filled with the sysctl entry
  1879. * for this, the second will be the sentinel (ctl_name == 0).
  1880. *
  1881. * We allocate everything in one go so that we don't have to
  1882. * worry about freeing additional memory in unregister_sysctl_table.
  1883. */
  1884. header = kzalloc(sizeof(struct ctl_table_header) +
  1885. (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
  1886. if (!header)
  1887. return NULL;
  1888. new = (struct ctl_table *) (header + 1);
  1889. /* Now connect the dots */
  1890. prevp = &header->ctl_table;
  1891. for (n = 0; n < npath; ++n, ++path) {
  1892. /* Copy the procname */
  1893. new->procname = path->procname;
  1894. new->ctl_name = path->ctl_name;
  1895. new->mode = 0555;
  1896. *prevp = new;
  1897. prevp = &new->child;
  1898. new += 2;
  1899. }
  1900. *prevp = table;
  1901. header->ctl_table_arg = table;
  1902. INIT_LIST_HEAD(&header->ctl_entry);
  1903. header->used = 0;
  1904. header->unregistering = NULL;
  1905. header->root = root;
  1906. sysctl_set_parent(NULL, header->ctl_table);
  1907. header->count = 1;
  1908. #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
  1909. if (sysctl_check_table(namespaces, header->ctl_table)) {
  1910. kfree(header);
  1911. return NULL;
  1912. }
  1913. #endif
  1914. spin_lock(&sysctl_lock);
  1915. header->set = lookup_header_set(root, namespaces);
  1916. header->attached_by = header->ctl_table;
  1917. header->attached_to = root_table;
  1918. header->parent = &root_table_header;
  1919. for (set = header->set; set; set = set->parent) {
  1920. struct ctl_table_header *p;
  1921. list_for_each_entry(p, &set->list, ctl_entry) {
  1922. if (p->unregistering)
  1923. continue;
  1924. try_attach(p, header);
  1925. }
  1926. }
  1927. header->parent->count++;
  1928. list_add_tail(&header->ctl_entry, &header->set->list);
  1929. spin_unlock(&sysctl_lock);
  1930. return header;
  1931. }
  1932. /**
  1933. * register_sysctl_table_path - register a sysctl table hierarchy
  1934. * @path: The path to the directory the sysctl table is in.
  1935. * @table: the top-level table structure
  1936. *
  1937. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1938. * array. A completely 0 filled entry terminates the table.
  1939. *
  1940. * See __register_sysctl_paths for more details.
  1941. */
  1942. struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
  1943. struct ctl_table *table)
  1944. {
  1945. return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
  1946. path, table);
  1947. }
  1948. /**
  1949. * register_sysctl_table - register a sysctl table hierarchy
  1950. * @table: the top-level table structure
  1951. *
  1952. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1953. * array. A completely 0 filled entry terminates the table.
  1954. *
  1955. * See register_sysctl_paths for more details.
  1956. */
  1957. struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
  1958. {
  1959. static const struct ctl_path null_path[] = { {} };
  1960. return register_sysctl_paths(null_path, table);
  1961. }
  1962. /**
  1963. * unregister_sysctl_table - unregister a sysctl table hierarchy
  1964. * @header: the header returned from register_sysctl_table
  1965. *
  1966. * Unregisters the sysctl table and all children. proc entries may not
  1967. * actually be removed until they are no longer used by anyone.
  1968. */
  1969. void unregister_sysctl_table(struct ctl_table_header * header)
  1970. {
  1971. might_sleep();
  1972. if (header == NULL)
  1973. return;
  1974. spin_lock(&sysctl_lock);
  1975. start_unregistering(header);
  1976. if (!--header->parent->count) {
  1977. WARN_ON(1);
  1978. kfree(header->parent);
  1979. }
  1980. if (!--header->count)
  1981. kfree(header);
  1982. spin_unlock(&sysctl_lock);
  1983. }
  1984. int sysctl_is_seen(struct ctl_table_header *p)
  1985. {
  1986. struct ctl_table_set *set = p->set;
  1987. int res;
  1988. spin_lock(&sysctl_lock);
  1989. if (p->unregistering)
  1990. res = 0;
  1991. else if (!set->is_seen)
  1992. res = 1;
  1993. else
  1994. res = set->is_seen(set);
  1995. spin_unlock(&sysctl_lock);
  1996. return res;
  1997. }
  1998. void setup_sysctl_set(struct ctl_table_set *p,
  1999. struct ctl_table_set *parent,
  2000. int (*is_seen)(struct ctl_table_set *))
  2001. {
  2002. INIT_LIST_HEAD(&p->list);
  2003. p->parent = parent ? parent : &sysctl_table_root.default_set;
  2004. p->is_seen = is_seen;
  2005. }
  2006. #else /* !CONFIG_SYSCTL */
  2007. struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
  2008. {
  2009. return NULL;
  2010. }
  2011. struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
  2012. struct ctl_table *table)
  2013. {
  2014. return NULL;
  2015. }
  2016. void unregister_sysctl_table(struct ctl_table_header * table)
  2017. {
  2018. }
  2019. void setup_sysctl_set(struct ctl_table_set *p,
  2020. struct ctl_table_set *parent,
  2021. int (*is_seen)(struct ctl_table_set *))
  2022. {
  2023. }
  2024. void sysctl_head_put(struct ctl_table_header *head)
  2025. {
  2026. }
  2027. #endif /* CONFIG_SYSCTL */
  2028. /*
  2029. * /proc/sys support
  2030. */
  2031. #ifdef CONFIG_PROC_SYSCTL
  2032. static int _proc_do_string(void* data, int maxlen, int write,
  2033. struct file *filp, void __user *buffer,
  2034. size_t *lenp, loff_t *ppos)
  2035. {
  2036. size_t len;
  2037. char __user *p;
  2038. char c;
  2039. if (!data || !maxlen || !*lenp) {
  2040. *lenp = 0;
  2041. return 0;
  2042. }
  2043. if (write) {
  2044. len = 0;
  2045. p = buffer;
  2046. while (len < *lenp) {
  2047. if (get_user(c, p++))
  2048. return -EFAULT;
  2049. if (c == 0 || c == '\n')
  2050. break;
  2051. len++;
  2052. }
  2053. if (len >= maxlen)
  2054. len = maxlen-1;
  2055. if(copy_from_user(data, buffer, len))
  2056. return -EFAULT;
  2057. ((char *) data)[len] = 0;
  2058. *ppos += *lenp;
  2059. } else {
  2060. len = strlen(data);
  2061. if (len > maxlen)
  2062. len = maxlen;
  2063. if (*ppos > len) {
  2064. *lenp = 0;
  2065. return 0;
  2066. }
  2067. data += *ppos;
  2068. len -= *ppos;
  2069. if (len > *lenp)
  2070. len = *lenp;
  2071. if (len)
  2072. if(copy_to_user(buffer, data, len))
  2073. return -EFAULT;
  2074. if (len < *lenp) {
  2075. if(put_user('\n', ((char __user *) buffer) + len))
  2076. return -EFAULT;
  2077. len++;
  2078. }
  2079. *lenp = len;
  2080. *ppos += len;
  2081. }
  2082. return 0;
  2083. }
  2084. /**
  2085. * proc_dostring - read a string sysctl
  2086. * @table: the sysctl table
  2087. * @write: %TRUE if this is a write to the sysctl file
  2088. * @filp: the file structure
  2089. * @buffer: the user buffer
  2090. * @lenp: the size of the user buffer
  2091. * @ppos: file position
  2092. *
  2093. * Reads/writes a string from/to the user buffer. If the kernel
  2094. * buffer provided is not large enough to hold the string, the
  2095. * string is truncated. The copied string is %NULL-terminated.
  2096. * If the string is being read by the user process, it is copied
  2097. * and a newline '\n' is added. It is truncated if the buffer is
  2098. * not large enough.
  2099. *
  2100. * Returns 0 on success.
  2101. */
  2102. int proc_dostring(struct ctl_table *table, int write, struct file *filp,
  2103. void __user *buffer, size_t *lenp, loff_t *ppos)
  2104. {
  2105. return _proc_do_string(table->data, table->maxlen, write, filp,
  2106. buffer, lenp, ppos);
  2107. }
  2108. static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
  2109. int *valp,
  2110. int write, void *data)
  2111. {
  2112. if (write) {
  2113. *valp = *negp ? -*lvalp : *lvalp;
  2114. } else {
  2115. int val = *valp;
  2116. if (val < 0) {
  2117. *negp = -1;
  2118. *lvalp = (unsigned long)-val;
  2119. } else {
  2120. *negp = 0;
  2121. *lvalp = (unsigned long)val;
  2122. }
  2123. }
  2124. return 0;
  2125. }
  2126. static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
  2127. int write, struct file *filp, void __user *buffer,
  2128. size_t *lenp, loff_t *ppos,
  2129. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  2130. int write, void *data),
  2131. void *data)
  2132. {
  2133. #define TMPBUFLEN 21
  2134. int *i, vleft, first=1, neg, val;
  2135. unsigned long lval;
  2136. size_t left, len;
  2137. char buf[TMPBUFLEN], *p;
  2138. char __user *s = buffer;
  2139. if (!tbl_data || !table->maxlen || !*lenp ||
  2140. (*ppos && !write)) {
  2141. *lenp = 0;
  2142. return 0;
  2143. }
  2144. i = (int *) tbl_data;
  2145. vleft = table->maxlen / sizeof(*i);
  2146. left = *lenp;
  2147. if (!conv)
  2148. conv = do_proc_dointvec_conv;
  2149. for (; left && vleft--; i++, first=0) {
  2150. if (write) {
  2151. while (left) {
  2152. char c;
  2153. if (get_user(c, s))
  2154. return -EFAULT;
  2155. if (!isspace(c))
  2156. break;
  2157. left--;
  2158. s++;
  2159. }
  2160. if (!left)
  2161. break;
  2162. neg = 0;
  2163. len = left;
  2164. if (len > sizeof(buf) - 1)
  2165. len = sizeof(buf) - 1;
  2166. if (copy_from_user(buf, s, len))
  2167. return -EFAULT;
  2168. buf[len] = 0;
  2169. p = buf;
  2170. if (*p == '-' && left > 1) {
  2171. neg = 1;
  2172. p++;
  2173. }
  2174. if (*p < '0' || *p > '9')
  2175. break;
  2176. lval = simple_strtoul(p, &p, 0);
  2177. len = p-buf;
  2178. if ((len < left) && *p && !isspace(*p))
  2179. break;
  2180. if (neg)
  2181. val = -val;
  2182. s += len;
  2183. left -= len;
  2184. if (conv(&neg, &lval, i, 1, data))
  2185. break;
  2186. } else {
  2187. p = buf;
  2188. if (!first)
  2189. *p++ = '\t';
  2190. if (conv(&neg, &lval, i, 0, data))
  2191. break;
  2192. sprintf(p, "%s%lu", neg ? "-" : "", lval);
  2193. len = strlen(buf);
  2194. if (len > left)
  2195. len = left;
  2196. if(copy_to_user(s, buf, len))
  2197. return -EFAULT;
  2198. left -= len;
  2199. s += len;
  2200. }
  2201. }
  2202. if (!write && !first && left) {
  2203. if(put_user('\n', s))
  2204. return -EFAULT;
  2205. left--, s++;
  2206. }
  2207. if (write) {
  2208. while (left) {
  2209. char c;
  2210. if (get_user(c, s++))
  2211. return -EFAULT;
  2212. if (!isspace(c))
  2213. break;
  2214. left--;
  2215. }
  2216. }
  2217. if (write && first)
  2218. return -EINVAL;
  2219. *lenp -= left;
  2220. *ppos += *lenp;
  2221. return 0;
  2222. #undef TMPBUFLEN
  2223. }
  2224. static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
  2225. void __user *buffer, size_t *lenp, loff_t *ppos,
  2226. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  2227. int write, void *data),
  2228. void *data)
  2229. {
  2230. return __do_proc_dointvec(table->data, table, write, filp,
  2231. buffer, lenp, ppos, conv, data);
  2232. }
  2233. /**
  2234. * proc_dointvec - read a vector of integers
  2235. * @table: the sysctl table
  2236. * @write: %TRUE if this is a write to the sysctl file
  2237. * @filp: the file structure
  2238. * @buffer: the user buffer
  2239. * @lenp: the size of the user buffer
  2240. * @ppos: file position
  2241. *
  2242. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2243. * values from/to the user buffer, treated as an ASCII string.
  2244. *
  2245. * Returns 0 on success.
  2246. */
  2247. int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
  2248. void __user *buffer, size_t *lenp, loff_t *ppos)
  2249. {
  2250. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2251. NULL,NULL);
  2252. }
  2253. /*
  2254. * Taint values can only be increased
  2255. * This means we can safely use a temporary.
  2256. */
  2257. static int proc_taint(struct ctl_table *table, int write, struct file *filp,
  2258. void __user *buffer, size_t *lenp, loff_t *ppos)
  2259. {
  2260. struct ctl_table t;
  2261. unsigned long tmptaint = get_taint();
  2262. int err;
  2263. if (write && !capable(CAP_SYS_ADMIN))
  2264. return -EPERM;
  2265. t = *table;
  2266. t.data = &tmptaint;
  2267. err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
  2268. if (err < 0)
  2269. return err;
  2270. if (write) {
  2271. /*
  2272. * Poor man's atomic or. Not worth adding a primitive
  2273. * to everyone's atomic.h for this
  2274. */
  2275. int i;
  2276. for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
  2277. if ((tmptaint >> i) & 1)
  2278. add_taint(i);
  2279. }
  2280. }
  2281. return err;
  2282. }
  2283. struct do_proc_dointvec_minmax_conv_param {
  2284. int *min;
  2285. int *max;
  2286. };
  2287. static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  2288. int *valp,
  2289. int write, void *data)
  2290. {
  2291. struct do_proc_dointvec_minmax_conv_param *param = data;
  2292. if (write) {
  2293. int val = *negp ? -*lvalp : *lvalp;
  2294. if ((param->min && *param->min > val) ||
  2295. (param->max && *param->max < val))
  2296. return -EINVAL;
  2297. *valp = val;
  2298. } else {
  2299. int val = *valp;
  2300. if (val < 0) {
  2301. *negp = -1;
  2302. *lvalp = (unsigned long)-val;
  2303. } else {
  2304. *negp = 0;
  2305. *lvalp = (unsigned long)val;
  2306. }
  2307. }
  2308. return 0;
  2309. }
  2310. /**
  2311. * proc_dointvec_minmax - read a vector of integers with min/max values
  2312. * @table: the sysctl table
  2313. * @write: %TRUE if this is a write to the sysctl file
  2314. * @filp: the file structure
  2315. * @buffer: the user buffer
  2316. * @lenp: the size of the user buffer
  2317. * @ppos: file position
  2318. *
  2319. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2320. * values from/to the user buffer, treated as an ASCII string.
  2321. *
  2322. * This routine will ensure the values are within the range specified by
  2323. * table->extra1 (min) and table->extra2 (max).
  2324. *
  2325. * Returns 0 on success.
  2326. */
  2327. int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
  2328. void __user *buffer, size_t *lenp, loff_t *ppos)
  2329. {
  2330. struct do_proc_dointvec_minmax_conv_param param = {
  2331. .min = (int *) table->extra1,
  2332. .max = (int *) table->extra2,
  2333. };
  2334. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  2335. do_proc_dointvec_minmax_conv, &param);
  2336. }
  2337. static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
  2338. struct file *filp,
  2339. void __user *buffer,
  2340. size_t *lenp, loff_t *ppos,
  2341. unsigned long convmul,
  2342. unsigned long convdiv)
  2343. {
  2344. #define TMPBUFLEN 21
  2345. unsigned long *i, *min, *max, val;
  2346. int vleft, first=1, neg;
  2347. size_t len, left;
  2348. char buf[TMPBUFLEN], *p;
  2349. char __user *s = buffer;
  2350. if (!data || !table->maxlen || !*lenp ||
  2351. (*ppos && !write)) {
  2352. *lenp = 0;
  2353. return 0;
  2354. }
  2355. i = (unsigned long *) data;
  2356. min = (unsigned long *) table->extra1;
  2357. max = (unsigned long *) table->extra2;
  2358. vleft = table->maxlen / sizeof(unsigned long);
  2359. left = *lenp;
  2360. for (; left && vleft--; i++, min++, max++, first=0) {
  2361. if (write) {
  2362. while (left) {
  2363. char c;
  2364. if (get_user(c, s))
  2365. return -EFAULT;
  2366. if (!isspace(c))
  2367. break;
  2368. left--;
  2369. s++;
  2370. }
  2371. if (!left)
  2372. break;
  2373. neg = 0;
  2374. len = left;
  2375. if (len > TMPBUFLEN-1)
  2376. len = TMPBUFLEN-1;
  2377. if (copy_from_user(buf, s, len))
  2378. return -EFAULT;
  2379. buf[len] = 0;
  2380. p = buf;
  2381. if (*p == '-' && left > 1) {
  2382. neg = 1;
  2383. p++;
  2384. }
  2385. if (*p < '0' || *p > '9')
  2386. break;
  2387. val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
  2388. len = p-buf;
  2389. if ((len < left) && *p && !isspace(*p))
  2390. break;
  2391. if (neg)
  2392. val = -val;
  2393. s += len;
  2394. left -= len;
  2395. if(neg)
  2396. continue;
  2397. if ((min && val < *min) || (max && val > *max))
  2398. continue;
  2399. *i = val;
  2400. } else {
  2401. p = buf;
  2402. if (!first)
  2403. *p++ = '\t';
  2404. sprintf(p, "%lu", convdiv * (*i) / convmul);
  2405. len = strlen(buf);
  2406. if (len > left)
  2407. len = left;
  2408. if(copy_to_user(s, buf, len))
  2409. return -EFAULT;
  2410. left -= len;
  2411. s += len;
  2412. }
  2413. }
  2414. if (!write && !first && left) {
  2415. if(put_user('\n', s))
  2416. return -EFAULT;
  2417. left--, s++;
  2418. }
  2419. if (write) {
  2420. while (left) {
  2421. char c;
  2422. if (get_user(c, s++))
  2423. return -EFAULT;
  2424. if (!isspace(c))
  2425. break;
  2426. left--;
  2427. }
  2428. }
  2429. if (write && first)
  2430. return -EINVAL;
  2431. *lenp -= left;
  2432. *ppos += *lenp;
  2433. return 0;
  2434. #undef TMPBUFLEN
  2435. }
  2436. static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
  2437. struct file *filp,
  2438. void __user *buffer,
  2439. size_t *lenp, loff_t *ppos,
  2440. unsigned long convmul,
  2441. unsigned long convdiv)
  2442. {
  2443. return __do_proc_doulongvec_minmax(table->data, table, write,
  2444. filp, buffer, lenp, ppos, convmul, convdiv);
  2445. }
  2446. /**
  2447. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  2448. * @table: the sysctl table
  2449. * @write: %TRUE if this is a write to the sysctl file
  2450. * @filp: the file structure
  2451. * @buffer: the user buffer
  2452. * @lenp: the size of the user buffer
  2453. * @ppos: file position
  2454. *
  2455. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2456. * values from/to the user buffer, treated as an ASCII string.
  2457. *
  2458. * This routine will ensure the values are within the range specified by
  2459. * table->extra1 (min) and table->extra2 (max).
  2460. *
  2461. * Returns 0 on success.
  2462. */
  2463. int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
  2464. void __user *buffer, size_t *lenp, loff_t *ppos)
  2465. {
  2466. return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
  2467. }
  2468. /**
  2469. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  2470. * @table: the sysctl table
  2471. * @write: %TRUE if this is a write to the sysctl file
  2472. * @filp: the file structure
  2473. * @buffer: the user buffer
  2474. * @lenp: the size of the user buffer
  2475. * @ppos: file position
  2476. *
  2477. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2478. * values from/to the user buffer, treated as an ASCII string. The values
  2479. * are treated as milliseconds, and converted to jiffies when they are stored.
  2480. *
  2481. * This routine will ensure the values are within the range specified by
  2482. * table->extra1 (min) and table->extra2 (max).
  2483. *
  2484. * Returns 0 on success.
  2485. */
  2486. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  2487. struct file *filp,
  2488. void __user *buffer,
  2489. size_t *lenp, loff_t *ppos)
  2490. {
  2491. return do_proc_doulongvec_minmax(table, write, filp, buffer,
  2492. lenp, ppos, HZ, 1000l);
  2493. }
  2494. static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
  2495. int *valp,
  2496. int write, void *data)
  2497. {
  2498. if (write) {
  2499. if (*lvalp > LONG_MAX / HZ)
  2500. return 1;
  2501. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  2502. } else {
  2503. int val = *valp;
  2504. unsigned long lval;
  2505. if (val < 0) {
  2506. *negp = -1;
  2507. lval = (unsigned long)-val;
  2508. } else {
  2509. *negp = 0;
  2510. lval = (unsigned long)val;
  2511. }
  2512. *lvalp = lval / HZ;
  2513. }
  2514. return 0;
  2515. }
  2516. static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  2517. int *valp,
  2518. int write, void *data)
  2519. {
  2520. if (write) {
  2521. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2522. return 1;
  2523. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2524. } else {
  2525. int val = *valp;
  2526. unsigned long lval;
  2527. if (val < 0) {
  2528. *negp = -1;
  2529. lval = (unsigned long)-val;
  2530. } else {
  2531. *negp = 0;
  2532. lval = (unsigned long)val;
  2533. }
  2534. *lvalp = jiffies_to_clock_t(lval);
  2535. }
  2536. return 0;
  2537. }
  2538. static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
  2539. int *valp,
  2540. int write, void *data)
  2541. {
  2542. if (write) {
  2543. *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  2544. } else {
  2545. int val = *valp;
  2546. unsigned long lval;
  2547. if (val < 0) {
  2548. *negp = -1;
  2549. lval = (unsigned long)-val;
  2550. } else {
  2551. *negp = 0;
  2552. lval = (unsigned long)val;
  2553. }
  2554. *lvalp = jiffies_to_msecs(lval);
  2555. }
  2556. return 0;
  2557. }
  2558. /**
  2559. * proc_dointvec_jiffies - read a vector of integers as seconds
  2560. * @table: the sysctl table
  2561. * @write: %TRUE if this is a write to the sysctl file
  2562. * @filp: the file structure
  2563. * @buffer: the user buffer
  2564. * @lenp: the size of the user buffer
  2565. * @ppos: file position
  2566. *
  2567. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2568. * values from/to the user buffer, treated as an ASCII string.
  2569. * The values read are assumed to be in seconds, and are converted into
  2570. * jiffies.
  2571. *
  2572. * Returns 0 on success.
  2573. */
  2574. int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
  2575. void __user *buffer, size_t *lenp, loff_t *ppos)
  2576. {
  2577. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2578. do_proc_dointvec_jiffies_conv,NULL);
  2579. }
  2580. /**
  2581. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2582. * @table: the sysctl table
  2583. * @write: %TRUE if this is a write to the sysctl file
  2584. * @filp: the file structure
  2585. * @buffer: the user buffer
  2586. * @lenp: the size of the user buffer
  2587. * @ppos: pointer to the file position
  2588. *
  2589. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2590. * values from/to the user buffer, treated as an ASCII string.
  2591. * The values read are assumed to be in 1/USER_HZ seconds, and
  2592. * are converted into jiffies.
  2593. *
  2594. * Returns 0 on success.
  2595. */
  2596. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
  2597. void __user *buffer, size_t *lenp, loff_t *ppos)
  2598. {
  2599. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2600. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2601. }
  2602. /**
  2603. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2604. * @table: the sysctl table
  2605. * @write: %TRUE if this is a write to the sysctl file
  2606. * @filp: the file structure
  2607. * @buffer: the user buffer
  2608. * @lenp: the size of the user buffer
  2609. * @ppos: file position
  2610. * @ppos: the current position in the file
  2611. *
  2612. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2613. * values from/to the user buffer, treated as an ASCII string.
  2614. * The values read are assumed to be in 1/1000 seconds, and
  2615. * are converted into jiffies.
  2616. *
  2617. * Returns 0 on success.
  2618. */
  2619. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
  2620. void __user *buffer, size_t *lenp, loff_t *ppos)
  2621. {
  2622. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  2623. do_proc_dointvec_ms_jiffies_conv, NULL);
  2624. }
  2625. static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
  2626. void __user *buffer, size_t *lenp, loff_t *ppos)
  2627. {
  2628. struct pid *new_pid;
  2629. pid_t tmp;
  2630. int r;
  2631. tmp = pid_vnr(cad_pid);
  2632. r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
  2633. lenp, ppos, NULL, NULL);
  2634. if (r || !write)
  2635. return r;
  2636. new_pid = find_get_pid(tmp);
  2637. if (!new_pid)
  2638. return -ESRCH;
  2639. put_pid(xchg(&cad_pid, new_pid));
  2640. return 0;
  2641. }
  2642. #else /* CONFIG_PROC_FS */
  2643. int proc_dostring(struct ctl_table *table, int write, struct file *filp,
  2644. void __user *buffer, size_t *lenp, loff_t *ppos)
  2645. {
  2646. return -ENOSYS;
  2647. }
  2648. int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
  2649. void __user *buffer, size_t *lenp, loff_t *ppos)
  2650. {
  2651. return -ENOSYS;
  2652. }
  2653. int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
  2654. void __user *buffer, size_t *lenp, loff_t *ppos)
  2655. {
  2656. return -ENOSYS;
  2657. }
  2658. int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
  2659. void __user *buffer, size_t *lenp, loff_t *ppos)
  2660. {
  2661. return -ENOSYS;
  2662. }
  2663. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
  2664. void __user *buffer, size_t *lenp, loff_t *ppos)
  2665. {
  2666. return -ENOSYS;
  2667. }
  2668. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
  2669. void __user *buffer, size_t *lenp, loff_t *ppos)
  2670. {
  2671. return -ENOSYS;
  2672. }
  2673. int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
  2674. void __user *buffer, size_t *lenp, loff_t *ppos)
  2675. {
  2676. return -ENOSYS;
  2677. }
  2678. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  2679. struct file *filp,
  2680. void __user *buffer,
  2681. size_t *lenp, loff_t *ppos)
  2682. {
  2683. return -ENOSYS;
  2684. }
  2685. #endif /* CONFIG_PROC_FS */
  2686. #ifdef CONFIG_SYSCTL_SYSCALL
  2687. /*
  2688. * General sysctl support routines
  2689. */
  2690. /* The generic sysctl data routine (used if no strategy routine supplied) */
  2691. int sysctl_data(struct ctl_table *table,
  2692. void __user *oldval, size_t __user *oldlenp,
  2693. void __user *newval, size_t newlen)
  2694. {
  2695. size_t len;
  2696. /* Get out of I don't have a variable */
  2697. if (!table->data || !table->maxlen)
  2698. return -ENOTDIR;
  2699. if (oldval && oldlenp) {
  2700. if (get_user(len, oldlenp))
  2701. return -EFAULT;
  2702. if (len) {
  2703. if (len > table->maxlen)
  2704. len = table->maxlen;
  2705. if (copy_to_user(oldval, table->data, len))
  2706. return -EFAULT;
  2707. if (put_user(len, oldlenp))
  2708. return -EFAULT;
  2709. }
  2710. }
  2711. if (newval && newlen) {
  2712. if (newlen > table->maxlen)
  2713. newlen = table->maxlen;
  2714. if (copy_from_user(table->data, newval, newlen))
  2715. return -EFAULT;
  2716. }
  2717. return 1;
  2718. }
  2719. /* The generic string strategy routine: */
  2720. int sysctl_string(struct ctl_table *table,
  2721. void __user *oldval, size_t __user *oldlenp,
  2722. void __user *newval, size_t newlen)
  2723. {
  2724. if (!table->data || !table->maxlen)
  2725. return -ENOTDIR;
  2726. if (oldval && oldlenp) {
  2727. size_t bufsize;
  2728. if (get_user(bufsize, oldlenp))
  2729. return -EFAULT;
  2730. if (bufsize) {
  2731. size_t len = strlen(table->data), copied;
  2732. /* This shouldn't trigger for a well-formed sysctl */
  2733. if (len > table->maxlen)
  2734. len = table->maxlen;
  2735. /* Copy up to a max of bufsize-1 bytes of the string */
  2736. copied = (len >= bufsize) ? bufsize - 1 : len;
  2737. if (copy_to_user(oldval, table->data, copied) ||
  2738. put_user(0, (char __user *)(oldval + copied)))
  2739. return -EFAULT;
  2740. if (put_user(len, oldlenp))
  2741. return -EFAULT;
  2742. }
  2743. }
  2744. if (newval && newlen) {
  2745. size_t len = newlen;
  2746. if (len > table->maxlen)
  2747. len = table->maxlen;
  2748. if(copy_from_user(table->data, newval, len))
  2749. return -EFAULT;
  2750. if (len == table->maxlen)
  2751. len--;
  2752. ((char *) table->data)[len] = 0;
  2753. }
  2754. return 1;
  2755. }
  2756. /*
  2757. * This function makes sure that all of the integers in the vector
  2758. * are between the minimum and maximum values given in the arrays
  2759. * table->extra1 and table->extra2, respectively.
  2760. */
  2761. int sysctl_intvec(struct ctl_table *table,
  2762. void __user *oldval, size_t __user *oldlenp,
  2763. void __user *newval, size_t newlen)
  2764. {
  2765. if (newval && newlen) {
  2766. int __user *vec = (int __user *) newval;
  2767. int *min = (int *) table->extra1;
  2768. int *max = (int *) table->extra2;
  2769. size_t length;
  2770. int i;
  2771. if (newlen % sizeof(int) != 0)
  2772. return -EINVAL;
  2773. if (!table->extra1 && !table->extra2)
  2774. return 0;
  2775. if (newlen > table->maxlen)
  2776. newlen = table->maxlen;
  2777. length = newlen / sizeof(int);
  2778. for (i = 0; i < length; i++) {
  2779. int value;
  2780. if (get_user(value, vec + i))
  2781. return -EFAULT;
  2782. if (min && value < min[i])
  2783. return -EINVAL;
  2784. if (max && value > max[i])
  2785. return -EINVAL;
  2786. }
  2787. }
  2788. return 0;
  2789. }
  2790. /* Strategy function to convert jiffies to seconds */
  2791. int sysctl_jiffies(struct ctl_table *table,
  2792. void __user *oldval, size_t __user *oldlenp,
  2793. void __user *newval, size_t newlen)
  2794. {
  2795. if (oldval && oldlenp) {
  2796. size_t olen;
  2797. if (get_user(olen, oldlenp))
  2798. return -EFAULT;
  2799. if (olen) {
  2800. int val;
  2801. if (olen < sizeof(int))
  2802. return -EINVAL;
  2803. val = *(int *)(table->data) / HZ;
  2804. if (put_user(val, (int __user *)oldval))
  2805. return -EFAULT;
  2806. if (put_user(sizeof(int), oldlenp))
  2807. return -EFAULT;
  2808. }
  2809. }
  2810. if (newval && newlen) {
  2811. int new;
  2812. if (newlen != sizeof(int))
  2813. return -EINVAL;
  2814. if (get_user(new, (int __user *)newval))
  2815. return -EFAULT;
  2816. *(int *)(table->data) = new*HZ;
  2817. }
  2818. return 1;
  2819. }
  2820. /* Strategy function to convert jiffies to seconds */
  2821. int sysctl_ms_jiffies(struct ctl_table *table,
  2822. void __user *oldval, size_t __user *oldlenp,
  2823. void __user *newval, size_t newlen)
  2824. {
  2825. if (oldval && oldlenp) {
  2826. size_t olen;
  2827. if (get_user(olen, oldlenp))
  2828. return -EFAULT;
  2829. if (olen) {
  2830. int val;
  2831. if (olen < sizeof(int))
  2832. return -EINVAL;
  2833. val = jiffies_to_msecs(*(int *)(table->data));
  2834. if (put_user(val, (int __user *)oldval))
  2835. return -EFAULT;
  2836. if (put_user(sizeof(int), oldlenp))
  2837. return -EFAULT;
  2838. }
  2839. }
  2840. if (newval && newlen) {
  2841. int new;
  2842. if (newlen != sizeof(int))
  2843. return -EINVAL;
  2844. if (get_user(new, (int __user *)newval))
  2845. return -EFAULT;
  2846. *(int *)(table->data) = msecs_to_jiffies(new);
  2847. }
  2848. return 1;
  2849. }
  2850. #else /* CONFIG_SYSCTL_SYSCALL */
  2851. SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
  2852. {
  2853. struct __sysctl_args tmp;
  2854. int error;
  2855. if (copy_from_user(&tmp, args, sizeof(tmp)))
  2856. return -EFAULT;
  2857. error = deprecated_sysctl_warning(&tmp);
  2858. /* If no error reading the parameters then just -ENOSYS ... */
  2859. if (!error)
  2860. error = -ENOSYS;
  2861. return error;
  2862. }
  2863. int sysctl_data(struct ctl_table *table,
  2864. void __user *oldval, size_t __user *oldlenp,
  2865. void __user *newval, size_t newlen)
  2866. {
  2867. return -ENOSYS;
  2868. }
  2869. int sysctl_string(struct ctl_table *table,
  2870. void __user *oldval, size_t __user *oldlenp,
  2871. void __user *newval, size_t newlen)
  2872. {
  2873. return -ENOSYS;
  2874. }
  2875. int sysctl_intvec(struct ctl_table *table,
  2876. void __user *oldval, size_t __user *oldlenp,
  2877. void __user *newval, size_t newlen)
  2878. {
  2879. return -ENOSYS;
  2880. }
  2881. int sysctl_jiffies(struct ctl_table *table,
  2882. void __user *oldval, size_t __user *oldlenp,
  2883. void __user *newval, size_t newlen)
  2884. {
  2885. return -ENOSYS;
  2886. }
  2887. int sysctl_ms_jiffies(struct ctl_table *table,
  2888. void __user *oldval, size_t __user *oldlenp,
  2889. void __user *newval, size_t newlen)
  2890. {
  2891. return -ENOSYS;
  2892. }
  2893. #endif /* CONFIG_SYSCTL_SYSCALL */
  2894. static int deprecated_sysctl_warning(struct __sysctl_args *args)
  2895. {
  2896. static int msg_count;
  2897. int name[CTL_MAXNAME];
  2898. int i;
  2899. /* Check args->nlen. */
  2900. if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
  2901. return -ENOTDIR;
  2902. /* Read in the sysctl name for better debug message logging */
  2903. for (i = 0; i < args->nlen; i++)
  2904. if (get_user(name[i], args->name + i))
  2905. return -EFAULT;
  2906. /* Ignore accesses to kernel.version */
  2907. if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
  2908. return 0;
  2909. if (msg_count < 5) {
  2910. msg_count++;
  2911. printk(KERN_INFO
  2912. "warning: process `%s' used the deprecated sysctl "
  2913. "system call with ", current->comm);
  2914. for (i = 0; i < args->nlen; i++)
  2915. printk("%d.", name[i]);
  2916. printk("\n");
  2917. }
  2918. return 0;
  2919. }
  2920. /*
  2921. * No sense putting this after each symbol definition, twice,
  2922. * exception granted :-)
  2923. */
  2924. EXPORT_SYMBOL(proc_dointvec);
  2925. EXPORT_SYMBOL(proc_dointvec_jiffies);
  2926. EXPORT_SYMBOL(proc_dointvec_minmax);
  2927. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  2928. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  2929. EXPORT_SYMBOL(proc_dostring);
  2930. EXPORT_SYMBOL(proc_doulongvec_minmax);
  2931. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
  2932. EXPORT_SYMBOL(register_sysctl_table);
  2933. EXPORT_SYMBOL(register_sysctl_paths);
  2934. EXPORT_SYMBOL(sysctl_intvec);
  2935. EXPORT_SYMBOL(sysctl_jiffies);
  2936. EXPORT_SYMBOL(sysctl_ms_jiffies);
  2937. EXPORT_SYMBOL(sysctl_string);
  2938. EXPORT_SYMBOL(sysctl_data);
  2939. EXPORT_SYMBOL(unregister_sysctl_table);