sysctl.c 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547
  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/capability.h>
  27. #include <linux/ctype.h>
  28. #include <linux/utsname.h>
  29. #include <linux/capability.h>
  30. #include <linux/smp_lock.h>
  31. #include <linux/fs.h>
  32. #include <linux/init.h>
  33. #include <linux/kernel.h>
  34. #include <linux/kobject.h>
  35. #include <linux/net.h>
  36. #include <linux/sysrq.h>
  37. #include <linux/highuid.h>
  38. #include <linux/writeback.h>
  39. #include <linux/hugetlb.h>
  40. #include <linux/security.h>
  41. #include <linux/initrd.h>
  42. #include <linux/times.h>
  43. #include <linux/limits.h>
  44. #include <linux/dcache.h>
  45. #include <linux/syscalls.h>
  46. #include <linux/nfs_fs.h>
  47. #include <linux/acpi.h>
  48. #include <linux/reboot.h>
  49. #include <asm/uaccess.h>
  50. #include <asm/processor.h>
  51. #ifdef CONFIG_X86
  52. #include <asm/nmi.h>
  53. #include <asm/stacktrace.h>
  54. #endif
  55. #if defined(CONFIG_SYSCTL)
  56. /* External variables not in a header file. */
  57. extern int C_A_D;
  58. extern int print_fatal_signals;
  59. extern int sysctl_overcommit_memory;
  60. extern int sysctl_overcommit_ratio;
  61. extern int sysctl_panic_on_oom;
  62. extern int max_threads;
  63. extern int core_uses_pid;
  64. extern int suid_dumpable;
  65. extern char core_pattern[];
  66. extern int pid_max;
  67. extern int min_free_kbytes;
  68. extern int printk_ratelimit_jiffies;
  69. extern int printk_ratelimit_burst;
  70. extern int pid_max_min, pid_max_max;
  71. extern int sysctl_drop_caches;
  72. extern int percpu_pagelist_fraction;
  73. extern int compat_log;
  74. extern int maps_protect;
  75. extern int sysctl_stat_interval;
  76. extern int audit_argv_kb;
  77. /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  78. static int maxolduid = 65535;
  79. static int minolduid;
  80. static int min_percpu_pagelist_fract = 8;
  81. static int ngroups_max = NGROUPS_MAX;
  82. #ifdef CONFIG_KMOD
  83. extern char modprobe_path[];
  84. #endif
  85. #ifdef CONFIG_CHR_DEV_SG
  86. extern int sg_big_buff;
  87. #endif
  88. #ifdef __sparc__
  89. extern char reboot_command [];
  90. extern int stop_a_enabled;
  91. extern int scons_pwroff;
  92. #endif
  93. #ifdef __hppa__
  94. extern int pwrsw_enabled;
  95. extern int unaligned_enabled;
  96. #endif
  97. #ifdef CONFIG_S390
  98. #ifdef CONFIG_MATHEMU
  99. extern int sysctl_ieee_emulation_warnings;
  100. #endif
  101. extern int sysctl_userprocess_debug;
  102. extern int spin_retry;
  103. #endif
  104. extern int sysctl_hz_timer;
  105. #ifdef CONFIG_BSD_PROCESS_ACCT
  106. extern int acct_parm[];
  107. #endif
  108. #ifdef CONFIG_IA64
  109. extern int no_unaligned_warning;
  110. #endif
  111. #ifdef CONFIG_RT_MUTEXES
  112. extern int max_lock_depth;
  113. #endif
  114. #ifdef CONFIG_SYSCTL_SYSCALL
  115. static int parse_table(int __user *, int, void __user *, size_t __user *,
  116. void __user *, size_t, ctl_table *);
  117. #endif
  118. #ifdef CONFIG_PROC_SYSCTL
  119. static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
  120. void __user *buffer, size_t *lenp, loff_t *ppos);
  121. static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
  122. void __user *buffer, size_t *lenp, loff_t *ppos);
  123. #endif
  124. static ctl_table root_table[];
  125. static struct ctl_table_header root_table_header =
  126. { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
  127. static ctl_table kern_table[];
  128. static ctl_table vm_table[];
  129. static ctl_table fs_table[];
  130. static ctl_table debug_table[];
  131. static ctl_table dev_table[];
  132. extern ctl_table random_table[];
  133. #ifdef CONFIG_UNIX98_PTYS
  134. extern ctl_table pty_table[];
  135. #endif
  136. #ifdef CONFIG_INOTIFY_USER
  137. extern ctl_table inotify_table[];
  138. #endif
  139. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  140. int sysctl_legacy_va_layout;
  141. #endif
  142. /* The default sysctl tables: */
  143. static ctl_table root_table[] = {
  144. {
  145. .ctl_name = CTL_KERN,
  146. .procname = "kernel",
  147. .mode = 0555,
  148. .child = kern_table,
  149. },
  150. {
  151. .ctl_name = CTL_VM,
  152. .procname = "vm",
  153. .mode = 0555,
  154. .child = vm_table,
  155. },
  156. #ifdef CONFIG_NET
  157. {
  158. .ctl_name = CTL_NET,
  159. .procname = "net",
  160. .mode = 0555,
  161. .child = net_table,
  162. },
  163. #endif
  164. {
  165. .ctl_name = CTL_FS,
  166. .procname = "fs",
  167. .mode = 0555,
  168. .child = fs_table,
  169. },
  170. {
  171. .ctl_name = CTL_DEBUG,
  172. .procname = "debug",
  173. .mode = 0555,
  174. .child = debug_table,
  175. },
  176. {
  177. .ctl_name = CTL_DEV,
  178. .procname = "dev",
  179. .mode = 0555,
  180. .child = dev_table,
  181. },
  182. /*
  183. * NOTE: do not add new entries to this table unless you have read
  184. * Documentation/sysctl/ctl_unnumbered.txt
  185. */
  186. { .ctl_name = 0 }
  187. };
  188. #ifdef CONFIG_SCHED_DEBUG
  189. static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */
  190. static unsigned long max_sched_granularity_ns = 1000000000; /* 1 second */
  191. static unsigned long min_wakeup_granularity_ns; /* 0 usecs */
  192. static unsigned long max_wakeup_granularity_ns = 1000000000; /* 1 second */
  193. #endif
  194. static ctl_table kern_table[] = {
  195. #ifdef CONFIG_SCHED_DEBUG
  196. {
  197. .ctl_name = CTL_UNNUMBERED,
  198. .procname = "sched_granularity_ns",
  199. .data = &sysctl_sched_granularity,
  200. .maxlen = sizeof(unsigned int),
  201. .mode = 0644,
  202. .proc_handler = &proc_dointvec_minmax,
  203. .strategy = &sysctl_intvec,
  204. .extra1 = &min_sched_granularity_ns,
  205. .extra2 = &max_sched_granularity_ns,
  206. },
  207. {
  208. .ctl_name = CTL_UNNUMBERED,
  209. .procname = "sched_wakeup_granularity_ns",
  210. .data = &sysctl_sched_wakeup_granularity,
  211. .maxlen = sizeof(unsigned int),
  212. .mode = 0644,
  213. .proc_handler = &proc_dointvec_minmax,
  214. .strategy = &sysctl_intvec,
  215. .extra1 = &min_wakeup_granularity_ns,
  216. .extra2 = &max_wakeup_granularity_ns,
  217. },
  218. {
  219. .ctl_name = CTL_UNNUMBERED,
  220. .procname = "sched_batch_wakeup_granularity_ns",
  221. .data = &sysctl_sched_batch_wakeup_granularity,
  222. .maxlen = sizeof(unsigned int),
  223. .mode = 0644,
  224. .proc_handler = &proc_dointvec_minmax,
  225. .strategy = &sysctl_intvec,
  226. .extra1 = &min_wakeup_granularity_ns,
  227. .extra2 = &max_wakeup_granularity_ns,
  228. },
  229. {
  230. .ctl_name = CTL_UNNUMBERED,
  231. .procname = "sched_stat_granularity_ns",
  232. .data = &sysctl_sched_stat_granularity,
  233. .maxlen = sizeof(unsigned int),
  234. .mode = 0644,
  235. .proc_handler = &proc_dointvec_minmax,
  236. .strategy = &sysctl_intvec,
  237. .extra1 = &min_wakeup_granularity_ns,
  238. .extra2 = &max_wakeup_granularity_ns,
  239. },
  240. {
  241. .ctl_name = CTL_UNNUMBERED,
  242. .procname = "sched_runtime_limit_ns",
  243. .data = &sysctl_sched_runtime_limit,
  244. .maxlen = sizeof(unsigned int),
  245. .mode = 0644,
  246. .proc_handler = &proc_dointvec_minmax,
  247. .strategy = &sysctl_intvec,
  248. .extra1 = &min_sched_granularity_ns,
  249. .extra2 = &max_sched_granularity_ns,
  250. },
  251. {
  252. .ctl_name = CTL_UNNUMBERED,
  253. .procname = "sched_child_runs_first",
  254. .data = &sysctl_sched_child_runs_first,
  255. .maxlen = sizeof(unsigned int),
  256. .mode = 0644,
  257. .proc_handler = &proc_dointvec,
  258. },
  259. {
  260. .ctl_name = CTL_UNNUMBERED,
  261. .procname = "sched_features",
  262. .data = &sysctl_sched_features,
  263. .maxlen = sizeof(unsigned int),
  264. .mode = 0644,
  265. .proc_handler = &proc_dointvec,
  266. },
  267. #endif
  268. {
  269. .ctl_name = KERN_PANIC,
  270. .procname = "panic",
  271. .data = &panic_timeout,
  272. .maxlen = sizeof(int),
  273. .mode = 0644,
  274. .proc_handler = &proc_dointvec,
  275. },
  276. {
  277. .ctl_name = KERN_CORE_USES_PID,
  278. .procname = "core_uses_pid",
  279. .data = &core_uses_pid,
  280. .maxlen = sizeof(int),
  281. .mode = 0644,
  282. .proc_handler = &proc_dointvec,
  283. },
  284. #ifdef CONFIG_AUDITSYSCALL
  285. {
  286. .ctl_name = CTL_UNNUMBERED,
  287. .procname = "audit_argv_kb",
  288. .data = &audit_argv_kb,
  289. .maxlen = sizeof(int),
  290. .mode = 0644,
  291. .proc_handler = &proc_dointvec,
  292. },
  293. #endif
  294. {
  295. .ctl_name = KERN_CORE_PATTERN,
  296. .procname = "core_pattern",
  297. .data = core_pattern,
  298. .maxlen = CORENAME_MAX_SIZE,
  299. .mode = 0644,
  300. .proc_handler = &proc_dostring,
  301. .strategy = &sysctl_string,
  302. },
  303. #ifdef CONFIG_PROC_SYSCTL
  304. {
  305. .ctl_name = KERN_TAINTED,
  306. .procname = "tainted",
  307. .data = &tainted,
  308. .maxlen = sizeof(int),
  309. .mode = 0644,
  310. .proc_handler = &proc_dointvec_taint,
  311. },
  312. #endif
  313. {
  314. .ctl_name = KERN_CAP_BSET,
  315. .procname = "cap-bound",
  316. .data = &cap_bset,
  317. .maxlen = sizeof(kernel_cap_t),
  318. .mode = 0600,
  319. .proc_handler = &proc_dointvec_bset,
  320. },
  321. #ifdef CONFIG_BLK_DEV_INITRD
  322. {
  323. .ctl_name = KERN_REALROOTDEV,
  324. .procname = "real-root-dev",
  325. .data = &real_root_dev,
  326. .maxlen = sizeof(int),
  327. .mode = 0644,
  328. .proc_handler = &proc_dointvec,
  329. },
  330. #endif
  331. {
  332. .ctl_name = CTL_UNNUMBERED,
  333. .procname = "print-fatal-signals",
  334. .data = &print_fatal_signals,
  335. .maxlen = sizeof(int),
  336. .mode = 0644,
  337. .proc_handler = &proc_dointvec,
  338. },
  339. #ifdef __sparc__
  340. {
  341. .ctl_name = KERN_SPARC_REBOOT,
  342. .procname = "reboot-cmd",
  343. .data = reboot_command,
  344. .maxlen = 256,
  345. .mode = 0644,
  346. .proc_handler = &proc_dostring,
  347. .strategy = &sysctl_string,
  348. },
  349. {
  350. .ctl_name = KERN_SPARC_STOP_A,
  351. .procname = "stop-a",
  352. .data = &stop_a_enabled,
  353. .maxlen = sizeof (int),
  354. .mode = 0644,
  355. .proc_handler = &proc_dointvec,
  356. },
  357. {
  358. .ctl_name = KERN_SPARC_SCONS_PWROFF,
  359. .procname = "scons-poweroff",
  360. .data = &scons_pwroff,
  361. .maxlen = sizeof (int),
  362. .mode = 0644,
  363. .proc_handler = &proc_dointvec,
  364. },
  365. #endif
  366. #ifdef __hppa__
  367. {
  368. .ctl_name = KERN_HPPA_PWRSW,
  369. .procname = "soft-power",
  370. .data = &pwrsw_enabled,
  371. .maxlen = sizeof (int),
  372. .mode = 0644,
  373. .proc_handler = &proc_dointvec,
  374. },
  375. {
  376. .ctl_name = KERN_HPPA_UNALIGNED,
  377. .procname = "unaligned-trap",
  378. .data = &unaligned_enabled,
  379. .maxlen = sizeof (int),
  380. .mode = 0644,
  381. .proc_handler = &proc_dointvec,
  382. },
  383. #endif
  384. {
  385. .ctl_name = KERN_CTLALTDEL,
  386. .procname = "ctrl-alt-del",
  387. .data = &C_A_D,
  388. .maxlen = sizeof(int),
  389. .mode = 0644,
  390. .proc_handler = &proc_dointvec,
  391. },
  392. {
  393. .ctl_name = KERN_PRINTK,
  394. .procname = "printk",
  395. .data = &console_loglevel,
  396. .maxlen = 4*sizeof(int),
  397. .mode = 0644,
  398. .proc_handler = &proc_dointvec,
  399. },
  400. #ifdef CONFIG_KMOD
  401. {
  402. .ctl_name = KERN_MODPROBE,
  403. .procname = "modprobe",
  404. .data = &modprobe_path,
  405. .maxlen = KMOD_PATH_LEN,
  406. .mode = 0644,
  407. .proc_handler = &proc_dostring,
  408. .strategy = &sysctl_string,
  409. },
  410. #endif
  411. #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
  412. {
  413. .ctl_name = KERN_HOTPLUG,
  414. .procname = "hotplug",
  415. .data = &uevent_helper,
  416. .maxlen = UEVENT_HELPER_PATH_LEN,
  417. .mode = 0644,
  418. .proc_handler = &proc_dostring,
  419. .strategy = &sysctl_string,
  420. },
  421. #endif
  422. #ifdef CONFIG_CHR_DEV_SG
  423. {
  424. .ctl_name = KERN_SG_BIG_BUFF,
  425. .procname = "sg-big-buff",
  426. .data = &sg_big_buff,
  427. .maxlen = sizeof (int),
  428. .mode = 0444,
  429. .proc_handler = &proc_dointvec,
  430. },
  431. #endif
  432. #ifdef CONFIG_BSD_PROCESS_ACCT
  433. {
  434. .ctl_name = KERN_ACCT,
  435. .procname = "acct",
  436. .data = &acct_parm,
  437. .maxlen = 3*sizeof(int),
  438. .mode = 0644,
  439. .proc_handler = &proc_dointvec,
  440. },
  441. #endif
  442. #ifdef CONFIG_MAGIC_SYSRQ
  443. {
  444. .ctl_name = KERN_SYSRQ,
  445. .procname = "sysrq",
  446. .data = &__sysrq_enabled,
  447. .maxlen = sizeof (int),
  448. .mode = 0644,
  449. .proc_handler = &proc_dointvec,
  450. },
  451. #endif
  452. #ifdef CONFIG_PROC_SYSCTL
  453. {
  454. .ctl_name = KERN_CADPID,
  455. .procname = "cad_pid",
  456. .data = NULL,
  457. .maxlen = sizeof (int),
  458. .mode = 0600,
  459. .proc_handler = &proc_do_cad_pid,
  460. },
  461. #endif
  462. {
  463. .ctl_name = KERN_MAX_THREADS,
  464. .procname = "threads-max",
  465. .data = &max_threads,
  466. .maxlen = sizeof(int),
  467. .mode = 0644,
  468. .proc_handler = &proc_dointvec,
  469. },
  470. {
  471. .ctl_name = KERN_RANDOM,
  472. .procname = "random",
  473. .mode = 0555,
  474. .child = random_table,
  475. },
  476. #ifdef CONFIG_UNIX98_PTYS
  477. {
  478. .ctl_name = KERN_PTY,
  479. .procname = "pty",
  480. .mode = 0555,
  481. .child = pty_table,
  482. },
  483. #endif
  484. {
  485. .ctl_name = KERN_OVERFLOWUID,
  486. .procname = "overflowuid",
  487. .data = &overflowuid,
  488. .maxlen = sizeof(int),
  489. .mode = 0644,
  490. .proc_handler = &proc_dointvec_minmax,
  491. .strategy = &sysctl_intvec,
  492. .extra1 = &minolduid,
  493. .extra2 = &maxolduid,
  494. },
  495. {
  496. .ctl_name = KERN_OVERFLOWGID,
  497. .procname = "overflowgid",
  498. .data = &overflowgid,
  499. .maxlen = sizeof(int),
  500. .mode = 0644,
  501. .proc_handler = &proc_dointvec_minmax,
  502. .strategy = &sysctl_intvec,
  503. .extra1 = &minolduid,
  504. .extra2 = &maxolduid,
  505. },
  506. #ifdef CONFIG_S390
  507. #ifdef CONFIG_MATHEMU
  508. {
  509. .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
  510. .procname = "ieee_emulation_warnings",
  511. .data = &sysctl_ieee_emulation_warnings,
  512. .maxlen = sizeof(int),
  513. .mode = 0644,
  514. .proc_handler = &proc_dointvec,
  515. },
  516. #endif
  517. #ifdef CONFIG_NO_IDLE_HZ
  518. {
  519. .ctl_name = KERN_HZ_TIMER,
  520. .procname = "hz_timer",
  521. .data = &sysctl_hz_timer,
  522. .maxlen = sizeof(int),
  523. .mode = 0644,
  524. .proc_handler = &proc_dointvec,
  525. },
  526. #endif
  527. {
  528. .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
  529. .procname = "userprocess_debug",
  530. .data = &sysctl_userprocess_debug,
  531. .maxlen = sizeof(int),
  532. .mode = 0644,
  533. .proc_handler = &proc_dointvec,
  534. },
  535. #endif
  536. {
  537. .ctl_name = KERN_PIDMAX,
  538. .procname = "pid_max",
  539. .data = &pid_max,
  540. .maxlen = sizeof (int),
  541. .mode = 0644,
  542. .proc_handler = &proc_dointvec_minmax,
  543. .strategy = sysctl_intvec,
  544. .extra1 = &pid_max_min,
  545. .extra2 = &pid_max_max,
  546. },
  547. {
  548. .ctl_name = KERN_PANIC_ON_OOPS,
  549. .procname = "panic_on_oops",
  550. .data = &panic_on_oops,
  551. .maxlen = sizeof(int),
  552. .mode = 0644,
  553. .proc_handler = &proc_dointvec,
  554. },
  555. {
  556. .ctl_name = KERN_PRINTK_RATELIMIT,
  557. .procname = "printk_ratelimit",
  558. .data = &printk_ratelimit_jiffies,
  559. .maxlen = sizeof(int),
  560. .mode = 0644,
  561. .proc_handler = &proc_dointvec_jiffies,
  562. .strategy = &sysctl_jiffies,
  563. },
  564. {
  565. .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
  566. .procname = "printk_ratelimit_burst",
  567. .data = &printk_ratelimit_burst,
  568. .maxlen = sizeof(int),
  569. .mode = 0644,
  570. .proc_handler = &proc_dointvec,
  571. },
  572. {
  573. .ctl_name = KERN_NGROUPS_MAX,
  574. .procname = "ngroups_max",
  575. .data = &ngroups_max,
  576. .maxlen = sizeof (int),
  577. .mode = 0444,
  578. .proc_handler = &proc_dointvec,
  579. },
  580. #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  581. {
  582. .ctl_name = KERN_UNKNOWN_NMI_PANIC,
  583. .procname = "unknown_nmi_panic",
  584. .data = &unknown_nmi_panic,
  585. .maxlen = sizeof (int),
  586. .mode = 0644,
  587. .proc_handler = &proc_dointvec,
  588. },
  589. {
  590. .ctl_name = KERN_NMI_WATCHDOG,
  591. .procname = "nmi_watchdog",
  592. .data = &nmi_watchdog_enabled,
  593. .maxlen = sizeof (int),
  594. .mode = 0644,
  595. .proc_handler = &proc_nmi_enabled,
  596. },
  597. #endif
  598. #if defined(CONFIG_X86)
  599. {
  600. .ctl_name = KERN_PANIC_ON_NMI,
  601. .procname = "panic_on_unrecovered_nmi",
  602. .data = &panic_on_unrecovered_nmi,
  603. .maxlen = sizeof(int),
  604. .mode = 0644,
  605. .proc_handler = &proc_dointvec,
  606. },
  607. {
  608. .ctl_name = KERN_BOOTLOADER_TYPE,
  609. .procname = "bootloader_type",
  610. .data = &bootloader_type,
  611. .maxlen = sizeof (int),
  612. .mode = 0444,
  613. .proc_handler = &proc_dointvec,
  614. },
  615. {
  616. .ctl_name = CTL_UNNUMBERED,
  617. .procname = "kstack_depth_to_print",
  618. .data = &kstack_depth_to_print,
  619. .maxlen = sizeof(int),
  620. .mode = 0644,
  621. .proc_handler = &proc_dointvec,
  622. },
  623. #endif
  624. #if defined(CONFIG_MMU)
  625. {
  626. .ctl_name = KERN_RANDOMIZE,
  627. .procname = "randomize_va_space",
  628. .data = &randomize_va_space,
  629. .maxlen = sizeof(int),
  630. .mode = 0644,
  631. .proc_handler = &proc_dointvec,
  632. },
  633. #endif
  634. #if defined(CONFIG_S390) && defined(CONFIG_SMP)
  635. {
  636. .ctl_name = KERN_SPIN_RETRY,
  637. .procname = "spin_retry",
  638. .data = &spin_retry,
  639. .maxlen = sizeof (int),
  640. .mode = 0644,
  641. .proc_handler = &proc_dointvec,
  642. },
  643. #endif
  644. #ifdef CONFIG_ACPI_SLEEP
  645. {
  646. .ctl_name = KERN_ACPI_VIDEO_FLAGS,
  647. .procname = "acpi_video_flags",
  648. .data = &acpi_realmode_flags,
  649. .maxlen = sizeof (unsigned long),
  650. .mode = 0644,
  651. .proc_handler = &proc_doulongvec_minmax,
  652. },
  653. #endif
  654. #ifdef CONFIG_IA64
  655. {
  656. .ctl_name = KERN_IA64_UNALIGNED,
  657. .procname = "ignore-unaligned-usertrap",
  658. .data = &no_unaligned_warning,
  659. .maxlen = sizeof (int),
  660. .mode = 0644,
  661. .proc_handler = &proc_dointvec,
  662. },
  663. #endif
  664. #ifdef CONFIG_COMPAT
  665. {
  666. .ctl_name = KERN_COMPAT_LOG,
  667. .procname = "compat-log",
  668. .data = &compat_log,
  669. .maxlen = sizeof (int),
  670. .mode = 0644,
  671. .proc_handler = &proc_dointvec,
  672. },
  673. #endif
  674. #ifdef CONFIG_RT_MUTEXES
  675. {
  676. .ctl_name = KERN_MAX_LOCK_DEPTH,
  677. .procname = "max_lock_depth",
  678. .data = &max_lock_depth,
  679. .maxlen = sizeof(int),
  680. .mode = 0644,
  681. .proc_handler = &proc_dointvec,
  682. },
  683. #endif
  684. #ifdef CONFIG_PROC_FS
  685. {
  686. .ctl_name = CTL_UNNUMBERED,
  687. .procname = "maps_protect",
  688. .data = &maps_protect,
  689. .maxlen = sizeof(int),
  690. .mode = 0644,
  691. .proc_handler = &proc_dointvec,
  692. },
  693. #endif
  694. {
  695. .ctl_name = CTL_UNNUMBERED,
  696. .procname = "poweroff_cmd",
  697. .data = &poweroff_cmd,
  698. .maxlen = POWEROFF_CMD_PATH_LEN,
  699. .mode = 0644,
  700. .proc_handler = &proc_dostring,
  701. .strategy = &sysctl_string,
  702. },
  703. { .ctl_name = 0 }
  704. };
  705. /* Constants for minimum and maximum testing in vm_table.
  706. We use these as one-element integer vectors. */
  707. static int zero;
  708. static int two = 2;
  709. static int one_hundred = 100;
  710. static ctl_table vm_table[] = {
  711. {
  712. .ctl_name = VM_OVERCOMMIT_MEMORY,
  713. .procname = "overcommit_memory",
  714. .data = &sysctl_overcommit_memory,
  715. .maxlen = sizeof(sysctl_overcommit_memory),
  716. .mode = 0644,
  717. .proc_handler = &proc_dointvec,
  718. },
  719. {
  720. .ctl_name = VM_PANIC_ON_OOM,
  721. .procname = "panic_on_oom",
  722. .data = &sysctl_panic_on_oom,
  723. .maxlen = sizeof(sysctl_panic_on_oom),
  724. .mode = 0644,
  725. .proc_handler = &proc_dointvec,
  726. },
  727. {
  728. .ctl_name = VM_OVERCOMMIT_RATIO,
  729. .procname = "overcommit_ratio",
  730. .data = &sysctl_overcommit_ratio,
  731. .maxlen = sizeof(sysctl_overcommit_ratio),
  732. .mode = 0644,
  733. .proc_handler = &proc_dointvec,
  734. },
  735. {
  736. .ctl_name = VM_PAGE_CLUSTER,
  737. .procname = "page-cluster",
  738. .data = &page_cluster,
  739. .maxlen = sizeof(int),
  740. .mode = 0644,
  741. .proc_handler = &proc_dointvec,
  742. },
  743. {
  744. .ctl_name = VM_DIRTY_BACKGROUND,
  745. .procname = "dirty_background_ratio",
  746. .data = &dirty_background_ratio,
  747. .maxlen = sizeof(dirty_background_ratio),
  748. .mode = 0644,
  749. .proc_handler = &proc_dointvec_minmax,
  750. .strategy = &sysctl_intvec,
  751. .extra1 = &zero,
  752. .extra2 = &one_hundred,
  753. },
  754. {
  755. .ctl_name = VM_DIRTY_RATIO,
  756. .procname = "dirty_ratio",
  757. .data = &vm_dirty_ratio,
  758. .maxlen = sizeof(vm_dirty_ratio),
  759. .mode = 0644,
  760. .proc_handler = &proc_dointvec_minmax,
  761. .strategy = &sysctl_intvec,
  762. .extra1 = &zero,
  763. .extra2 = &one_hundred,
  764. },
  765. {
  766. .ctl_name = VM_DIRTY_WB_CS,
  767. .procname = "dirty_writeback_centisecs",
  768. .data = &dirty_writeback_interval,
  769. .maxlen = sizeof(dirty_writeback_interval),
  770. .mode = 0644,
  771. .proc_handler = &dirty_writeback_centisecs_handler,
  772. },
  773. {
  774. .ctl_name = VM_DIRTY_EXPIRE_CS,
  775. .procname = "dirty_expire_centisecs",
  776. .data = &dirty_expire_interval,
  777. .maxlen = sizeof(dirty_expire_interval),
  778. .mode = 0644,
  779. .proc_handler = &proc_dointvec_userhz_jiffies,
  780. },
  781. {
  782. .ctl_name = VM_NR_PDFLUSH_THREADS,
  783. .procname = "nr_pdflush_threads",
  784. .data = &nr_pdflush_threads,
  785. .maxlen = sizeof nr_pdflush_threads,
  786. .mode = 0444 /* read-only*/,
  787. .proc_handler = &proc_dointvec,
  788. },
  789. {
  790. .ctl_name = VM_SWAPPINESS,
  791. .procname = "swappiness",
  792. .data = &vm_swappiness,
  793. .maxlen = sizeof(vm_swappiness),
  794. .mode = 0644,
  795. .proc_handler = &proc_dointvec_minmax,
  796. .strategy = &sysctl_intvec,
  797. .extra1 = &zero,
  798. .extra2 = &one_hundred,
  799. },
  800. #ifdef CONFIG_HUGETLB_PAGE
  801. {
  802. .ctl_name = VM_HUGETLB_PAGES,
  803. .procname = "nr_hugepages",
  804. .data = &max_huge_pages,
  805. .maxlen = sizeof(unsigned long),
  806. .mode = 0644,
  807. .proc_handler = &hugetlb_sysctl_handler,
  808. .extra1 = (void *)&hugetlb_zero,
  809. .extra2 = (void *)&hugetlb_infinity,
  810. },
  811. {
  812. .ctl_name = VM_HUGETLB_GROUP,
  813. .procname = "hugetlb_shm_group",
  814. .data = &sysctl_hugetlb_shm_group,
  815. .maxlen = sizeof(gid_t),
  816. .mode = 0644,
  817. .proc_handler = &proc_dointvec,
  818. },
  819. {
  820. .ctl_name = CTL_UNNUMBERED,
  821. .procname = "hugepages_treat_as_movable",
  822. .data = &hugepages_treat_as_movable,
  823. .maxlen = sizeof(int),
  824. .mode = 0644,
  825. .proc_handler = &hugetlb_treat_movable_handler,
  826. },
  827. #endif
  828. {
  829. .ctl_name = VM_LOWMEM_RESERVE_RATIO,
  830. .procname = "lowmem_reserve_ratio",
  831. .data = &sysctl_lowmem_reserve_ratio,
  832. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  833. .mode = 0644,
  834. .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
  835. .strategy = &sysctl_intvec,
  836. },
  837. {
  838. .ctl_name = VM_DROP_PAGECACHE,
  839. .procname = "drop_caches",
  840. .data = &sysctl_drop_caches,
  841. .maxlen = sizeof(int),
  842. .mode = 0644,
  843. .proc_handler = drop_caches_sysctl_handler,
  844. .strategy = &sysctl_intvec,
  845. },
  846. {
  847. .ctl_name = VM_MIN_FREE_KBYTES,
  848. .procname = "min_free_kbytes",
  849. .data = &min_free_kbytes,
  850. .maxlen = sizeof(min_free_kbytes),
  851. .mode = 0644,
  852. .proc_handler = &min_free_kbytes_sysctl_handler,
  853. .strategy = &sysctl_intvec,
  854. .extra1 = &zero,
  855. },
  856. {
  857. .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
  858. .procname = "percpu_pagelist_fraction",
  859. .data = &percpu_pagelist_fraction,
  860. .maxlen = sizeof(percpu_pagelist_fraction),
  861. .mode = 0644,
  862. .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
  863. .strategy = &sysctl_intvec,
  864. .extra1 = &min_percpu_pagelist_fract,
  865. },
  866. #ifdef CONFIG_MMU
  867. {
  868. .ctl_name = VM_MAX_MAP_COUNT,
  869. .procname = "max_map_count",
  870. .data = &sysctl_max_map_count,
  871. .maxlen = sizeof(sysctl_max_map_count),
  872. .mode = 0644,
  873. .proc_handler = &proc_dointvec
  874. },
  875. #endif
  876. {
  877. .ctl_name = VM_LAPTOP_MODE,
  878. .procname = "laptop_mode",
  879. .data = &laptop_mode,
  880. .maxlen = sizeof(laptop_mode),
  881. .mode = 0644,
  882. .proc_handler = &proc_dointvec_jiffies,
  883. .strategy = &sysctl_jiffies,
  884. },
  885. {
  886. .ctl_name = VM_BLOCK_DUMP,
  887. .procname = "block_dump",
  888. .data = &block_dump,
  889. .maxlen = sizeof(block_dump),
  890. .mode = 0644,
  891. .proc_handler = &proc_dointvec,
  892. .strategy = &sysctl_intvec,
  893. .extra1 = &zero,
  894. },
  895. {
  896. .ctl_name = VM_VFS_CACHE_PRESSURE,
  897. .procname = "vfs_cache_pressure",
  898. .data = &sysctl_vfs_cache_pressure,
  899. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  900. .mode = 0644,
  901. .proc_handler = &proc_dointvec,
  902. .strategy = &sysctl_intvec,
  903. .extra1 = &zero,
  904. },
  905. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  906. {
  907. .ctl_name = VM_LEGACY_VA_LAYOUT,
  908. .procname = "legacy_va_layout",
  909. .data = &sysctl_legacy_va_layout,
  910. .maxlen = sizeof(sysctl_legacy_va_layout),
  911. .mode = 0644,
  912. .proc_handler = &proc_dointvec,
  913. .strategy = &sysctl_intvec,
  914. .extra1 = &zero,
  915. },
  916. #endif
  917. #ifdef CONFIG_NUMA
  918. {
  919. .ctl_name = VM_ZONE_RECLAIM_MODE,
  920. .procname = "zone_reclaim_mode",
  921. .data = &zone_reclaim_mode,
  922. .maxlen = sizeof(zone_reclaim_mode),
  923. .mode = 0644,
  924. .proc_handler = &proc_dointvec,
  925. .strategy = &sysctl_intvec,
  926. .extra1 = &zero,
  927. },
  928. {
  929. .ctl_name = VM_MIN_UNMAPPED,
  930. .procname = "min_unmapped_ratio",
  931. .data = &sysctl_min_unmapped_ratio,
  932. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  933. .mode = 0644,
  934. .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
  935. .strategy = &sysctl_intvec,
  936. .extra1 = &zero,
  937. .extra2 = &one_hundred,
  938. },
  939. {
  940. .ctl_name = VM_MIN_SLAB,
  941. .procname = "min_slab_ratio",
  942. .data = &sysctl_min_slab_ratio,
  943. .maxlen = sizeof(sysctl_min_slab_ratio),
  944. .mode = 0644,
  945. .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
  946. .strategy = &sysctl_intvec,
  947. .extra1 = &zero,
  948. .extra2 = &one_hundred,
  949. },
  950. #endif
  951. #ifdef CONFIG_SMP
  952. {
  953. .ctl_name = CTL_UNNUMBERED,
  954. .procname = "stat_interval",
  955. .data = &sysctl_stat_interval,
  956. .maxlen = sizeof(sysctl_stat_interval),
  957. .mode = 0644,
  958. .proc_handler = &proc_dointvec_jiffies,
  959. .strategy = &sysctl_jiffies,
  960. },
  961. #endif
  962. #ifdef CONFIG_SECURITY
  963. {
  964. .ctl_name = CTL_UNNUMBERED,
  965. .procname = "mmap_min_addr",
  966. .data = &mmap_min_addr,
  967. .maxlen = sizeof(unsigned long),
  968. .mode = 0644,
  969. .proc_handler = &proc_doulongvec_minmax,
  970. },
  971. #ifdef CONFIG_NUMA
  972. {
  973. .ctl_name = CTL_UNNUMBERED,
  974. .procname = "numa_zonelist_order",
  975. .data = &numa_zonelist_order,
  976. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  977. .mode = 0644,
  978. .proc_handler = &numa_zonelist_order_handler,
  979. .strategy = &sysctl_string,
  980. },
  981. #endif
  982. #endif
  983. #if defined(CONFIG_X86_32) || \
  984. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  985. {
  986. .ctl_name = VM_VDSO_ENABLED,
  987. .procname = "vdso_enabled",
  988. .data = &vdso_enabled,
  989. .maxlen = sizeof(vdso_enabled),
  990. .mode = 0644,
  991. .proc_handler = &proc_dointvec,
  992. .strategy = &sysctl_intvec,
  993. .extra1 = &zero,
  994. },
  995. #endif
  996. /*
  997. * NOTE: do not add new entries to this table unless you have read
  998. * Documentation/sysctl/ctl_unnumbered.txt
  999. */
  1000. { .ctl_name = 0 }
  1001. };
  1002. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1003. static ctl_table binfmt_misc_table[] = {
  1004. { .ctl_name = 0 }
  1005. };
  1006. #endif
  1007. static ctl_table fs_table[] = {
  1008. {
  1009. .ctl_name = FS_NRINODE,
  1010. .procname = "inode-nr",
  1011. .data = &inodes_stat,
  1012. .maxlen = 2*sizeof(int),
  1013. .mode = 0444,
  1014. .proc_handler = &proc_dointvec,
  1015. },
  1016. {
  1017. .ctl_name = FS_STATINODE,
  1018. .procname = "inode-state",
  1019. .data = &inodes_stat,
  1020. .maxlen = 7*sizeof(int),
  1021. .mode = 0444,
  1022. .proc_handler = &proc_dointvec,
  1023. },
  1024. {
  1025. .ctl_name = FS_NRFILE,
  1026. .procname = "file-nr",
  1027. .data = &files_stat,
  1028. .maxlen = 3*sizeof(int),
  1029. .mode = 0444,
  1030. .proc_handler = &proc_nr_files,
  1031. },
  1032. {
  1033. .ctl_name = FS_MAXFILE,
  1034. .procname = "file-max",
  1035. .data = &files_stat.max_files,
  1036. .maxlen = sizeof(int),
  1037. .mode = 0644,
  1038. .proc_handler = &proc_dointvec,
  1039. },
  1040. {
  1041. .ctl_name = FS_DENTRY,
  1042. .procname = "dentry-state",
  1043. .data = &dentry_stat,
  1044. .maxlen = 6*sizeof(int),
  1045. .mode = 0444,
  1046. .proc_handler = &proc_dointvec,
  1047. },
  1048. {
  1049. .ctl_name = FS_OVERFLOWUID,
  1050. .procname = "overflowuid",
  1051. .data = &fs_overflowuid,
  1052. .maxlen = sizeof(int),
  1053. .mode = 0644,
  1054. .proc_handler = &proc_dointvec_minmax,
  1055. .strategy = &sysctl_intvec,
  1056. .extra1 = &minolduid,
  1057. .extra2 = &maxolduid,
  1058. },
  1059. {
  1060. .ctl_name = FS_OVERFLOWGID,
  1061. .procname = "overflowgid",
  1062. .data = &fs_overflowgid,
  1063. .maxlen = sizeof(int),
  1064. .mode = 0644,
  1065. .proc_handler = &proc_dointvec_minmax,
  1066. .strategy = &sysctl_intvec,
  1067. .extra1 = &minolduid,
  1068. .extra2 = &maxolduid,
  1069. },
  1070. {
  1071. .ctl_name = FS_LEASES,
  1072. .procname = "leases-enable",
  1073. .data = &leases_enable,
  1074. .maxlen = sizeof(int),
  1075. .mode = 0644,
  1076. .proc_handler = &proc_dointvec,
  1077. },
  1078. #ifdef CONFIG_DNOTIFY
  1079. {
  1080. .ctl_name = FS_DIR_NOTIFY,
  1081. .procname = "dir-notify-enable",
  1082. .data = &dir_notify_enable,
  1083. .maxlen = sizeof(int),
  1084. .mode = 0644,
  1085. .proc_handler = &proc_dointvec,
  1086. },
  1087. #endif
  1088. #ifdef CONFIG_MMU
  1089. {
  1090. .ctl_name = FS_LEASE_TIME,
  1091. .procname = "lease-break-time",
  1092. .data = &lease_break_time,
  1093. .maxlen = sizeof(int),
  1094. .mode = 0644,
  1095. .proc_handler = &proc_dointvec_minmax,
  1096. .strategy = &sysctl_intvec,
  1097. .extra1 = &zero,
  1098. .extra2 = &two,
  1099. },
  1100. {
  1101. .ctl_name = FS_AIO_NR,
  1102. .procname = "aio-nr",
  1103. .data = &aio_nr,
  1104. .maxlen = sizeof(aio_nr),
  1105. .mode = 0444,
  1106. .proc_handler = &proc_doulongvec_minmax,
  1107. },
  1108. {
  1109. .ctl_name = FS_AIO_MAX_NR,
  1110. .procname = "aio-max-nr",
  1111. .data = &aio_max_nr,
  1112. .maxlen = sizeof(aio_max_nr),
  1113. .mode = 0644,
  1114. .proc_handler = &proc_doulongvec_minmax,
  1115. },
  1116. #ifdef CONFIG_INOTIFY_USER
  1117. {
  1118. .ctl_name = FS_INOTIFY,
  1119. .procname = "inotify",
  1120. .mode = 0555,
  1121. .child = inotify_table,
  1122. },
  1123. #endif
  1124. #endif
  1125. {
  1126. .ctl_name = KERN_SETUID_DUMPABLE,
  1127. .procname = "suid_dumpable",
  1128. .data = &suid_dumpable,
  1129. .maxlen = sizeof(int),
  1130. .mode = 0644,
  1131. .proc_handler = &proc_dointvec,
  1132. },
  1133. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1134. {
  1135. .ctl_name = CTL_UNNUMBERED,
  1136. .procname = "binfmt_misc",
  1137. .mode = 0555,
  1138. .child = binfmt_misc_table,
  1139. },
  1140. #endif
  1141. /*
  1142. * NOTE: do not add new entries to this table unless you have read
  1143. * Documentation/sysctl/ctl_unnumbered.txt
  1144. */
  1145. { .ctl_name = 0 }
  1146. };
  1147. static ctl_table debug_table[] = {
  1148. { .ctl_name = 0 }
  1149. };
  1150. static ctl_table dev_table[] = {
  1151. { .ctl_name = 0 }
  1152. };
  1153. static DEFINE_SPINLOCK(sysctl_lock);
  1154. /* called under sysctl_lock */
  1155. static int use_table(struct ctl_table_header *p)
  1156. {
  1157. if (unlikely(p->unregistering))
  1158. return 0;
  1159. p->used++;
  1160. return 1;
  1161. }
  1162. /* called under sysctl_lock */
  1163. static void unuse_table(struct ctl_table_header *p)
  1164. {
  1165. if (!--p->used)
  1166. if (unlikely(p->unregistering))
  1167. complete(p->unregistering);
  1168. }
  1169. /* called under sysctl_lock, will reacquire if has to wait */
  1170. static void start_unregistering(struct ctl_table_header *p)
  1171. {
  1172. /*
  1173. * if p->used is 0, nobody will ever touch that entry again;
  1174. * we'll eliminate all paths to it before dropping sysctl_lock
  1175. */
  1176. if (unlikely(p->used)) {
  1177. struct completion wait;
  1178. init_completion(&wait);
  1179. p->unregistering = &wait;
  1180. spin_unlock(&sysctl_lock);
  1181. wait_for_completion(&wait);
  1182. spin_lock(&sysctl_lock);
  1183. }
  1184. /*
  1185. * do not remove from the list until nobody holds it; walking the
  1186. * list in do_sysctl() relies on that.
  1187. */
  1188. list_del_init(&p->ctl_entry);
  1189. }
  1190. void sysctl_head_finish(struct ctl_table_header *head)
  1191. {
  1192. if (!head)
  1193. return;
  1194. spin_lock(&sysctl_lock);
  1195. unuse_table(head);
  1196. spin_unlock(&sysctl_lock);
  1197. }
  1198. struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
  1199. {
  1200. struct ctl_table_header *head;
  1201. struct list_head *tmp;
  1202. spin_lock(&sysctl_lock);
  1203. if (prev) {
  1204. tmp = &prev->ctl_entry;
  1205. unuse_table(prev);
  1206. goto next;
  1207. }
  1208. tmp = &root_table_header.ctl_entry;
  1209. for (;;) {
  1210. head = list_entry(tmp, struct ctl_table_header, ctl_entry);
  1211. if (!use_table(head))
  1212. goto next;
  1213. spin_unlock(&sysctl_lock);
  1214. return head;
  1215. next:
  1216. tmp = tmp->next;
  1217. if (tmp == &root_table_header.ctl_entry)
  1218. break;
  1219. }
  1220. spin_unlock(&sysctl_lock);
  1221. return NULL;
  1222. }
  1223. #ifdef CONFIG_SYSCTL_SYSCALL
  1224. int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
  1225. void __user *newval, size_t newlen)
  1226. {
  1227. struct ctl_table_header *head;
  1228. int error = -ENOTDIR;
  1229. if (nlen <= 0 || nlen >= CTL_MAXNAME)
  1230. return -ENOTDIR;
  1231. if (oldval) {
  1232. int old_len;
  1233. if (!oldlenp || get_user(old_len, oldlenp))
  1234. return -EFAULT;
  1235. }
  1236. for (head = sysctl_head_next(NULL); head;
  1237. head = sysctl_head_next(head)) {
  1238. error = parse_table(name, nlen, oldval, oldlenp,
  1239. newval, newlen, head->ctl_table);
  1240. if (error != -ENOTDIR) {
  1241. sysctl_head_finish(head);
  1242. break;
  1243. }
  1244. }
  1245. return error;
  1246. }
  1247. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  1248. {
  1249. struct __sysctl_args tmp;
  1250. int error;
  1251. if (copy_from_user(&tmp, args, sizeof(tmp)))
  1252. return -EFAULT;
  1253. lock_kernel();
  1254. error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
  1255. tmp.newval, tmp.newlen);
  1256. unlock_kernel();
  1257. return error;
  1258. }
  1259. #endif /* CONFIG_SYSCTL_SYSCALL */
  1260. /*
  1261. * sysctl_perm does NOT grant the superuser all rights automatically, because
  1262. * some sysctl variables are readonly even to root.
  1263. */
  1264. static int test_perm(int mode, int op)
  1265. {
  1266. if (!current->euid)
  1267. mode >>= 6;
  1268. else if (in_egroup_p(0))
  1269. mode >>= 3;
  1270. if ((mode & op & 0007) == op)
  1271. return 0;
  1272. return -EACCES;
  1273. }
  1274. int sysctl_perm(ctl_table *table, int op)
  1275. {
  1276. int error;
  1277. error = security_sysctl(table, op);
  1278. if (error)
  1279. return error;
  1280. return test_perm(table->mode, op);
  1281. }
  1282. #ifdef CONFIG_SYSCTL_SYSCALL
  1283. static int parse_table(int __user *name, int nlen,
  1284. void __user *oldval, size_t __user *oldlenp,
  1285. void __user *newval, size_t newlen,
  1286. ctl_table *table)
  1287. {
  1288. int n;
  1289. repeat:
  1290. if (!nlen)
  1291. return -ENOTDIR;
  1292. if (get_user(n, name))
  1293. return -EFAULT;
  1294. for ( ; table->ctl_name || table->procname; table++) {
  1295. if (!table->ctl_name)
  1296. continue;
  1297. if (n == table->ctl_name) {
  1298. int error;
  1299. if (table->child) {
  1300. if (sysctl_perm(table, 001))
  1301. return -EPERM;
  1302. name++;
  1303. nlen--;
  1304. table = table->child;
  1305. goto repeat;
  1306. }
  1307. error = do_sysctl_strategy(table, name, nlen,
  1308. oldval, oldlenp,
  1309. newval, newlen);
  1310. return error;
  1311. }
  1312. }
  1313. return -ENOTDIR;
  1314. }
  1315. /* Perform the actual read/write of a sysctl table entry. */
  1316. int do_sysctl_strategy (ctl_table *table,
  1317. int __user *name, int nlen,
  1318. void __user *oldval, size_t __user *oldlenp,
  1319. void __user *newval, size_t newlen)
  1320. {
  1321. int op = 0, rc;
  1322. size_t len;
  1323. if (oldval)
  1324. op |= 004;
  1325. if (newval)
  1326. op |= 002;
  1327. if (sysctl_perm(table, op))
  1328. return -EPERM;
  1329. if (table->strategy) {
  1330. rc = table->strategy(table, name, nlen, oldval, oldlenp,
  1331. newval, newlen);
  1332. if (rc < 0)
  1333. return rc;
  1334. if (rc > 0)
  1335. return 0;
  1336. }
  1337. /* If there is no strategy routine, or if the strategy returns
  1338. * zero, proceed with automatic r/w */
  1339. if (table->data && table->maxlen) {
  1340. if (oldval && oldlenp) {
  1341. if (get_user(len, oldlenp))
  1342. return -EFAULT;
  1343. if (len) {
  1344. if (len > table->maxlen)
  1345. len = table->maxlen;
  1346. if(copy_to_user(oldval, table->data, len))
  1347. return -EFAULT;
  1348. if(put_user(len, oldlenp))
  1349. return -EFAULT;
  1350. }
  1351. }
  1352. if (newval && newlen) {
  1353. len = newlen;
  1354. if (len > table->maxlen)
  1355. len = table->maxlen;
  1356. if(copy_from_user(table->data, newval, len))
  1357. return -EFAULT;
  1358. }
  1359. }
  1360. return 0;
  1361. }
  1362. #endif /* CONFIG_SYSCTL_SYSCALL */
  1363. static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
  1364. {
  1365. for (; table->ctl_name || table->procname; table++) {
  1366. table->parent = parent;
  1367. if (table->child)
  1368. sysctl_set_parent(table, table->child);
  1369. }
  1370. }
  1371. static __init int sysctl_init(void)
  1372. {
  1373. sysctl_set_parent(NULL, root_table);
  1374. return 0;
  1375. }
  1376. core_initcall(sysctl_init);
  1377. /**
  1378. * register_sysctl_table - register a sysctl hierarchy
  1379. * @table: the top-level table structure
  1380. *
  1381. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1382. * array. An entry with a ctl_name of 0 terminates the table.
  1383. *
  1384. * The members of the &ctl_table structure are used as follows:
  1385. *
  1386. * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
  1387. * must be unique within that level of sysctl
  1388. *
  1389. * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
  1390. * enter a sysctl file
  1391. *
  1392. * data - a pointer to data for use by proc_handler
  1393. *
  1394. * maxlen - the maximum size in bytes of the data
  1395. *
  1396. * mode - the file permissions for the /proc/sys file, and for sysctl(2)
  1397. *
  1398. * child - a pointer to the child sysctl table if this entry is a directory, or
  1399. * %NULL.
  1400. *
  1401. * proc_handler - the text handler routine (described below)
  1402. *
  1403. * strategy - the strategy routine (described below)
  1404. *
  1405. * de - for internal use by the sysctl routines
  1406. *
  1407. * extra1, extra2 - extra pointers usable by the proc handler routines
  1408. *
  1409. * Leaf nodes in the sysctl tree will be represented by a single file
  1410. * under /proc; non-leaf nodes will be represented by directories.
  1411. *
  1412. * sysctl(2) can automatically manage read and write requests through
  1413. * the sysctl table. The data and maxlen fields of the ctl_table
  1414. * struct enable minimal validation of the values being written to be
  1415. * performed, and the mode field allows minimal authentication.
  1416. *
  1417. * More sophisticated management can be enabled by the provision of a
  1418. * strategy routine with the table entry. This will be called before
  1419. * any automatic read or write of the data is performed.
  1420. *
  1421. * The strategy routine may return
  1422. *
  1423. * < 0 - Error occurred (error is passed to user process)
  1424. *
  1425. * 0 - OK - proceed with automatic read or write.
  1426. *
  1427. * > 0 - OK - read or write has been done by the strategy routine, so
  1428. * return immediately.
  1429. *
  1430. * There must be a proc_handler routine for any terminal nodes
  1431. * mirrored under /proc/sys (non-terminals are handled by a built-in
  1432. * directory handler). Several default handlers are available to
  1433. * cover common cases -
  1434. *
  1435. * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
  1436. * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
  1437. * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
  1438. *
  1439. * It is the handler's job to read the input buffer from user memory
  1440. * and process it. The handler should return 0 on success.
  1441. *
  1442. * This routine returns %NULL on a failure to register, and a pointer
  1443. * to the table header on success.
  1444. */
  1445. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1446. {
  1447. struct ctl_table_header *tmp;
  1448. tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
  1449. if (!tmp)
  1450. return NULL;
  1451. tmp->ctl_table = table;
  1452. INIT_LIST_HEAD(&tmp->ctl_entry);
  1453. tmp->used = 0;
  1454. tmp->unregistering = NULL;
  1455. sysctl_set_parent(NULL, table);
  1456. spin_lock(&sysctl_lock);
  1457. list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
  1458. spin_unlock(&sysctl_lock);
  1459. return tmp;
  1460. }
  1461. /**
  1462. * unregister_sysctl_table - unregister a sysctl table hierarchy
  1463. * @header: the header returned from register_sysctl_table
  1464. *
  1465. * Unregisters the sysctl table and all children. proc entries may not
  1466. * actually be removed until they are no longer used by anyone.
  1467. */
  1468. void unregister_sysctl_table(struct ctl_table_header * header)
  1469. {
  1470. might_sleep();
  1471. spin_lock(&sysctl_lock);
  1472. start_unregistering(header);
  1473. spin_unlock(&sysctl_lock);
  1474. kfree(header);
  1475. }
  1476. #else /* !CONFIG_SYSCTL */
  1477. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1478. {
  1479. return NULL;
  1480. }
  1481. void unregister_sysctl_table(struct ctl_table_header * table)
  1482. {
  1483. }
  1484. #endif /* CONFIG_SYSCTL */
  1485. /*
  1486. * /proc/sys support
  1487. */
  1488. #ifdef CONFIG_PROC_SYSCTL
  1489. static int _proc_do_string(void* data, int maxlen, int write,
  1490. struct file *filp, void __user *buffer,
  1491. size_t *lenp, loff_t *ppos)
  1492. {
  1493. size_t len;
  1494. char __user *p;
  1495. char c;
  1496. if (!data || !maxlen || !*lenp) {
  1497. *lenp = 0;
  1498. return 0;
  1499. }
  1500. if (write) {
  1501. len = 0;
  1502. p = buffer;
  1503. while (len < *lenp) {
  1504. if (get_user(c, p++))
  1505. return -EFAULT;
  1506. if (c == 0 || c == '\n')
  1507. break;
  1508. len++;
  1509. }
  1510. if (len >= maxlen)
  1511. len = maxlen-1;
  1512. if(copy_from_user(data, buffer, len))
  1513. return -EFAULT;
  1514. ((char *) data)[len] = 0;
  1515. *ppos += *lenp;
  1516. } else {
  1517. len = strlen(data);
  1518. if (len > maxlen)
  1519. len = maxlen;
  1520. if (*ppos > len) {
  1521. *lenp = 0;
  1522. return 0;
  1523. }
  1524. data += *ppos;
  1525. len -= *ppos;
  1526. if (len > *lenp)
  1527. len = *lenp;
  1528. if (len)
  1529. if(copy_to_user(buffer, data, len))
  1530. return -EFAULT;
  1531. if (len < *lenp) {
  1532. if(put_user('\n', ((char __user *) buffer) + len))
  1533. return -EFAULT;
  1534. len++;
  1535. }
  1536. *lenp = len;
  1537. *ppos += len;
  1538. }
  1539. return 0;
  1540. }
  1541. /**
  1542. * proc_dostring - read a string sysctl
  1543. * @table: the sysctl table
  1544. * @write: %TRUE if this is a write to the sysctl file
  1545. * @filp: the file structure
  1546. * @buffer: the user buffer
  1547. * @lenp: the size of the user buffer
  1548. * @ppos: file position
  1549. *
  1550. * Reads/writes a string from/to the user buffer. If the kernel
  1551. * buffer provided is not large enough to hold the string, the
  1552. * string is truncated. The copied string is %NULL-terminated.
  1553. * If the string is being read by the user process, it is copied
  1554. * and a newline '\n' is added. It is truncated if the buffer is
  1555. * not large enough.
  1556. *
  1557. * Returns 0 on success.
  1558. */
  1559. int proc_dostring(ctl_table *table, int write, struct file *filp,
  1560. void __user *buffer, size_t *lenp, loff_t *ppos)
  1561. {
  1562. return _proc_do_string(table->data, table->maxlen, write, filp,
  1563. buffer, lenp, ppos);
  1564. }
  1565. static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
  1566. int *valp,
  1567. int write, void *data)
  1568. {
  1569. if (write) {
  1570. *valp = *negp ? -*lvalp : *lvalp;
  1571. } else {
  1572. int val = *valp;
  1573. if (val < 0) {
  1574. *negp = -1;
  1575. *lvalp = (unsigned long)-val;
  1576. } else {
  1577. *negp = 0;
  1578. *lvalp = (unsigned long)val;
  1579. }
  1580. }
  1581. return 0;
  1582. }
  1583. static int __do_proc_dointvec(void *tbl_data, ctl_table *table,
  1584. int write, struct file *filp, void __user *buffer,
  1585. size_t *lenp, loff_t *ppos,
  1586. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1587. int write, void *data),
  1588. void *data)
  1589. {
  1590. #define TMPBUFLEN 21
  1591. int *i, vleft, first=1, neg, val;
  1592. unsigned long lval;
  1593. size_t left, len;
  1594. char buf[TMPBUFLEN], *p;
  1595. char __user *s = buffer;
  1596. if (!tbl_data || !table->maxlen || !*lenp ||
  1597. (*ppos && !write)) {
  1598. *lenp = 0;
  1599. return 0;
  1600. }
  1601. i = (int *) tbl_data;
  1602. vleft = table->maxlen / sizeof(*i);
  1603. left = *lenp;
  1604. if (!conv)
  1605. conv = do_proc_dointvec_conv;
  1606. for (; left && vleft--; i++, first=0) {
  1607. if (write) {
  1608. while (left) {
  1609. char c;
  1610. if (get_user(c, s))
  1611. return -EFAULT;
  1612. if (!isspace(c))
  1613. break;
  1614. left--;
  1615. s++;
  1616. }
  1617. if (!left)
  1618. break;
  1619. neg = 0;
  1620. len = left;
  1621. if (len > sizeof(buf) - 1)
  1622. len = sizeof(buf) - 1;
  1623. if (copy_from_user(buf, s, len))
  1624. return -EFAULT;
  1625. buf[len] = 0;
  1626. p = buf;
  1627. if (*p == '-' && left > 1) {
  1628. neg = 1;
  1629. p++;
  1630. }
  1631. if (*p < '0' || *p > '9')
  1632. break;
  1633. lval = simple_strtoul(p, &p, 0);
  1634. len = p-buf;
  1635. if ((len < left) && *p && !isspace(*p))
  1636. break;
  1637. if (neg)
  1638. val = -val;
  1639. s += len;
  1640. left -= len;
  1641. if (conv(&neg, &lval, i, 1, data))
  1642. break;
  1643. } else {
  1644. p = buf;
  1645. if (!first)
  1646. *p++ = '\t';
  1647. if (conv(&neg, &lval, i, 0, data))
  1648. break;
  1649. sprintf(p, "%s%lu", neg ? "-" : "", lval);
  1650. len = strlen(buf);
  1651. if (len > left)
  1652. len = left;
  1653. if(copy_to_user(s, buf, len))
  1654. return -EFAULT;
  1655. left -= len;
  1656. s += len;
  1657. }
  1658. }
  1659. if (!write && !first && left) {
  1660. if(put_user('\n', s))
  1661. return -EFAULT;
  1662. left--, s++;
  1663. }
  1664. if (write) {
  1665. while (left) {
  1666. char c;
  1667. if (get_user(c, s++))
  1668. return -EFAULT;
  1669. if (!isspace(c))
  1670. break;
  1671. left--;
  1672. }
  1673. }
  1674. if (write && first)
  1675. return -EINVAL;
  1676. *lenp -= left;
  1677. *ppos += *lenp;
  1678. return 0;
  1679. #undef TMPBUFLEN
  1680. }
  1681. static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
  1682. void __user *buffer, size_t *lenp, loff_t *ppos,
  1683. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1684. int write, void *data),
  1685. void *data)
  1686. {
  1687. return __do_proc_dointvec(table->data, table, write, filp,
  1688. buffer, lenp, ppos, conv, data);
  1689. }
  1690. /**
  1691. * proc_dointvec - read a vector of integers
  1692. * @table: the sysctl table
  1693. * @write: %TRUE if this is a write to the sysctl file
  1694. * @filp: the file structure
  1695. * @buffer: the user buffer
  1696. * @lenp: the size of the user buffer
  1697. * @ppos: file position
  1698. *
  1699. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1700. * values from/to the user buffer, treated as an ASCII string.
  1701. *
  1702. * Returns 0 on success.
  1703. */
  1704. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  1705. void __user *buffer, size_t *lenp, loff_t *ppos)
  1706. {
  1707. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1708. NULL,NULL);
  1709. }
  1710. #define OP_SET 0
  1711. #define OP_AND 1
  1712. #define OP_OR 2
  1713. static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
  1714. int *valp,
  1715. int write, void *data)
  1716. {
  1717. int op = *(int *)data;
  1718. if (write) {
  1719. int val = *negp ? -*lvalp : *lvalp;
  1720. switch(op) {
  1721. case OP_SET: *valp = val; break;
  1722. case OP_AND: *valp &= val; break;
  1723. case OP_OR: *valp |= val; break;
  1724. }
  1725. } else {
  1726. int val = *valp;
  1727. if (val < 0) {
  1728. *negp = -1;
  1729. *lvalp = (unsigned long)-val;
  1730. } else {
  1731. *negp = 0;
  1732. *lvalp = (unsigned long)val;
  1733. }
  1734. }
  1735. return 0;
  1736. }
  1737. /*
  1738. * init may raise the set.
  1739. */
  1740. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  1741. void __user *buffer, size_t *lenp, loff_t *ppos)
  1742. {
  1743. int op;
  1744. if (write && !capable(CAP_SYS_MODULE)) {
  1745. return -EPERM;
  1746. }
  1747. op = is_init(current) ? OP_SET : OP_AND;
  1748. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1749. do_proc_dointvec_bset_conv,&op);
  1750. }
  1751. /*
  1752. * Taint values can only be increased
  1753. */
  1754. static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
  1755. void __user *buffer, size_t *lenp, loff_t *ppos)
  1756. {
  1757. int op;
  1758. if (write && !capable(CAP_SYS_ADMIN))
  1759. return -EPERM;
  1760. op = OP_OR;
  1761. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1762. do_proc_dointvec_bset_conv,&op);
  1763. }
  1764. struct do_proc_dointvec_minmax_conv_param {
  1765. int *min;
  1766. int *max;
  1767. };
  1768. static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  1769. int *valp,
  1770. int write, void *data)
  1771. {
  1772. struct do_proc_dointvec_minmax_conv_param *param = data;
  1773. if (write) {
  1774. int val = *negp ? -*lvalp : *lvalp;
  1775. if ((param->min && *param->min > val) ||
  1776. (param->max && *param->max < val))
  1777. return -EINVAL;
  1778. *valp = val;
  1779. } else {
  1780. int val = *valp;
  1781. if (val < 0) {
  1782. *negp = -1;
  1783. *lvalp = (unsigned long)-val;
  1784. } else {
  1785. *negp = 0;
  1786. *lvalp = (unsigned long)val;
  1787. }
  1788. }
  1789. return 0;
  1790. }
  1791. /**
  1792. * proc_dointvec_minmax - read a vector of integers with min/max values
  1793. * @table: the sysctl table
  1794. * @write: %TRUE if this is a write to the sysctl file
  1795. * @filp: the file structure
  1796. * @buffer: the user buffer
  1797. * @lenp: the size of the user buffer
  1798. * @ppos: file position
  1799. *
  1800. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1801. * values from/to the user buffer, treated as an ASCII string.
  1802. *
  1803. * This routine will ensure the values are within the range specified by
  1804. * table->extra1 (min) and table->extra2 (max).
  1805. *
  1806. * Returns 0 on success.
  1807. */
  1808. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  1809. void __user *buffer, size_t *lenp, loff_t *ppos)
  1810. {
  1811. struct do_proc_dointvec_minmax_conv_param param = {
  1812. .min = (int *) table->extra1,
  1813. .max = (int *) table->extra2,
  1814. };
  1815. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  1816. do_proc_dointvec_minmax_conv, &param);
  1817. }
  1818. static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,
  1819. struct file *filp,
  1820. void __user *buffer,
  1821. size_t *lenp, loff_t *ppos,
  1822. unsigned long convmul,
  1823. unsigned long convdiv)
  1824. {
  1825. #define TMPBUFLEN 21
  1826. unsigned long *i, *min, *max, val;
  1827. int vleft, first=1, neg;
  1828. size_t len, left;
  1829. char buf[TMPBUFLEN], *p;
  1830. char __user *s = buffer;
  1831. if (!data || !table->maxlen || !*lenp ||
  1832. (*ppos && !write)) {
  1833. *lenp = 0;
  1834. return 0;
  1835. }
  1836. i = (unsigned long *) data;
  1837. min = (unsigned long *) table->extra1;
  1838. max = (unsigned long *) table->extra2;
  1839. vleft = table->maxlen / sizeof(unsigned long);
  1840. left = *lenp;
  1841. for (; left && vleft--; i++, min++, max++, first=0) {
  1842. if (write) {
  1843. while (left) {
  1844. char c;
  1845. if (get_user(c, s))
  1846. return -EFAULT;
  1847. if (!isspace(c))
  1848. break;
  1849. left--;
  1850. s++;
  1851. }
  1852. if (!left)
  1853. break;
  1854. neg = 0;
  1855. len = left;
  1856. if (len > TMPBUFLEN-1)
  1857. len = TMPBUFLEN-1;
  1858. if (copy_from_user(buf, s, len))
  1859. return -EFAULT;
  1860. buf[len] = 0;
  1861. p = buf;
  1862. if (*p == '-' && left > 1) {
  1863. neg = 1;
  1864. p++;
  1865. }
  1866. if (*p < '0' || *p > '9')
  1867. break;
  1868. val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
  1869. len = p-buf;
  1870. if ((len < left) && *p && !isspace(*p))
  1871. break;
  1872. if (neg)
  1873. val = -val;
  1874. s += len;
  1875. left -= len;
  1876. if(neg)
  1877. continue;
  1878. if ((min && val < *min) || (max && val > *max))
  1879. continue;
  1880. *i = val;
  1881. } else {
  1882. p = buf;
  1883. if (!first)
  1884. *p++ = '\t';
  1885. sprintf(p, "%lu", convdiv * (*i) / convmul);
  1886. len = strlen(buf);
  1887. if (len > left)
  1888. len = left;
  1889. if(copy_to_user(s, buf, len))
  1890. return -EFAULT;
  1891. left -= len;
  1892. s += len;
  1893. }
  1894. }
  1895. if (!write && !first && left) {
  1896. if(put_user('\n', s))
  1897. return -EFAULT;
  1898. left--, s++;
  1899. }
  1900. if (write) {
  1901. while (left) {
  1902. char c;
  1903. if (get_user(c, s++))
  1904. return -EFAULT;
  1905. if (!isspace(c))
  1906. break;
  1907. left--;
  1908. }
  1909. }
  1910. if (write && first)
  1911. return -EINVAL;
  1912. *lenp -= left;
  1913. *ppos += *lenp;
  1914. return 0;
  1915. #undef TMPBUFLEN
  1916. }
  1917. static int do_proc_doulongvec_minmax(ctl_table *table, int write,
  1918. struct file *filp,
  1919. void __user *buffer,
  1920. size_t *lenp, loff_t *ppos,
  1921. unsigned long convmul,
  1922. unsigned long convdiv)
  1923. {
  1924. return __do_proc_doulongvec_minmax(table->data, table, write,
  1925. filp, buffer, lenp, ppos, convmul, convdiv);
  1926. }
  1927. /**
  1928. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  1929. * @table: the sysctl table
  1930. * @write: %TRUE if this is a write to the sysctl file
  1931. * @filp: the file structure
  1932. * @buffer: the user buffer
  1933. * @lenp: the size of the user buffer
  1934. * @ppos: file position
  1935. *
  1936. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1937. * values from/to the user buffer, treated as an ASCII string.
  1938. *
  1939. * This routine will ensure the values are within the range specified by
  1940. * table->extra1 (min) and table->extra2 (max).
  1941. *
  1942. * Returns 0 on success.
  1943. */
  1944. int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  1945. void __user *buffer, size_t *lenp, loff_t *ppos)
  1946. {
  1947. return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
  1948. }
  1949. /**
  1950. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  1951. * @table: the sysctl table
  1952. * @write: %TRUE if this is a write to the sysctl file
  1953. * @filp: the file structure
  1954. * @buffer: the user buffer
  1955. * @lenp: the size of the user buffer
  1956. * @ppos: file position
  1957. *
  1958. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1959. * values from/to the user buffer, treated as an ASCII string. The values
  1960. * are treated as milliseconds, and converted to jiffies when they are stored.
  1961. *
  1962. * This routine will ensure the values are within the range specified by
  1963. * table->extra1 (min) and table->extra2 (max).
  1964. *
  1965. * Returns 0 on success.
  1966. */
  1967. int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  1968. struct file *filp,
  1969. void __user *buffer,
  1970. size_t *lenp, loff_t *ppos)
  1971. {
  1972. return do_proc_doulongvec_minmax(table, write, filp, buffer,
  1973. lenp, ppos, HZ, 1000l);
  1974. }
  1975. static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
  1976. int *valp,
  1977. int write, void *data)
  1978. {
  1979. if (write) {
  1980. if (*lvalp > LONG_MAX / HZ)
  1981. return 1;
  1982. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  1983. } else {
  1984. int val = *valp;
  1985. unsigned long lval;
  1986. if (val < 0) {
  1987. *negp = -1;
  1988. lval = (unsigned long)-val;
  1989. } else {
  1990. *negp = 0;
  1991. lval = (unsigned long)val;
  1992. }
  1993. *lvalp = lval / HZ;
  1994. }
  1995. return 0;
  1996. }
  1997. static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  1998. int *valp,
  1999. int write, void *data)
  2000. {
  2001. if (write) {
  2002. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2003. return 1;
  2004. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2005. } else {
  2006. int val = *valp;
  2007. unsigned long lval;
  2008. if (val < 0) {
  2009. *negp = -1;
  2010. lval = (unsigned long)-val;
  2011. } else {
  2012. *negp = 0;
  2013. lval = (unsigned long)val;
  2014. }
  2015. *lvalp = jiffies_to_clock_t(lval);
  2016. }
  2017. return 0;
  2018. }
  2019. static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
  2020. int *valp,
  2021. int write, void *data)
  2022. {
  2023. if (write) {
  2024. *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  2025. } else {
  2026. int val = *valp;
  2027. unsigned long lval;
  2028. if (val < 0) {
  2029. *negp = -1;
  2030. lval = (unsigned long)-val;
  2031. } else {
  2032. *negp = 0;
  2033. lval = (unsigned long)val;
  2034. }
  2035. *lvalp = jiffies_to_msecs(lval);
  2036. }
  2037. return 0;
  2038. }
  2039. /**
  2040. * proc_dointvec_jiffies - read a vector of integers as seconds
  2041. * @table: the sysctl table
  2042. * @write: %TRUE if this is a write to the sysctl file
  2043. * @filp: the file structure
  2044. * @buffer: the user buffer
  2045. * @lenp: the size of the user buffer
  2046. * @ppos: file position
  2047. *
  2048. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2049. * values from/to the user buffer, treated as an ASCII string.
  2050. * The values read are assumed to be in seconds, and are converted into
  2051. * jiffies.
  2052. *
  2053. * Returns 0 on success.
  2054. */
  2055. int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  2056. void __user *buffer, size_t *lenp, loff_t *ppos)
  2057. {
  2058. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2059. do_proc_dointvec_jiffies_conv,NULL);
  2060. }
  2061. /**
  2062. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2063. * @table: the sysctl table
  2064. * @write: %TRUE if this is a write to the sysctl file
  2065. * @filp: the file structure
  2066. * @buffer: the user buffer
  2067. * @lenp: the size of the user buffer
  2068. * @ppos: pointer to the file position
  2069. *
  2070. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2071. * values from/to the user buffer, treated as an ASCII string.
  2072. * The values read are assumed to be in 1/USER_HZ seconds, and
  2073. * are converted into jiffies.
  2074. *
  2075. * Returns 0 on success.
  2076. */
  2077. int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
  2078. void __user *buffer, size_t *lenp, loff_t *ppos)
  2079. {
  2080. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2081. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2082. }
  2083. /**
  2084. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2085. * @table: the sysctl table
  2086. * @write: %TRUE if this is a write to the sysctl file
  2087. * @filp: the file structure
  2088. * @buffer: the user buffer
  2089. * @lenp: the size of the user buffer
  2090. * @ppos: file position
  2091. * @ppos: the current position in the file
  2092. *
  2093. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2094. * values from/to the user buffer, treated as an ASCII string.
  2095. * The values read are assumed to be in 1/1000 seconds, and
  2096. * are converted into jiffies.
  2097. *
  2098. * Returns 0 on success.
  2099. */
  2100. int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
  2101. void __user *buffer, size_t *lenp, loff_t *ppos)
  2102. {
  2103. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  2104. do_proc_dointvec_ms_jiffies_conv, NULL);
  2105. }
  2106. static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
  2107. void __user *buffer, size_t *lenp, loff_t *ppos)
  2108. {
  2109. struct pid *new_pid;
  2110. pid_t tmp;
  2111. int r;
  2112. tmp = pid_nr(cad_pid);
  2113. r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
  2114. lenp, ppos, NULL, NULL);
  2115. if (r || !write)
  2116. return r;
  2117. new_pid = find_get_pid(tmp);
  2118. if (!new_pid)
  2119. return -ESRCH;
  2120. put_pid(xchg(&cad_pid, new_pid));
  2121. return 0;
  2122. }
  2123. #else /* CONFIG_PROC_FS */
  2124. int proc_dostring(ctl_table *table, int write, struct file *filp,
  2125. void __user *buffer, size_t *lenp, loff_t *ppos)
  2126. {
  2127. return -ENOSYS;
  2128. }
  2129. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  2130. void __user *buffer, size_t *lenp, loff_t *ppos)
  2131. {
  2132. return -ENOSYS;
  2133. }
  2134. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  2135. void __user *buffer, size_t *lenp, loff_t *ppos)
  2136. {
  2137. return -ENOSYS;
  2138. }
  2139. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  2140. void __user *buffer, size_t *lenp, loff_t *ppos)
  2141. {
  2142. return -ENOSYS;
  2143. }
  2144. int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  2145. void __user *buffer, size_t *lenp, loff_t *ppos)
  2146. {
  2147. return -ENOSYS;
  2148. }
  2149. int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
  2150. void __user *buffer, size_t *lenp, loff_t *ppos)
  2151. {
  2152. return -ENOSYS;
  2153. }
  2154. int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
  2155. void __user *buffer, size_t *lenp, loff_t *ppos)
  2156. {
  2157. return -ENOSYS;
  2158. }
  2159. int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  2160. void __user *buffer, size_t *lenp, loff_t *ppos)
  2161. {
  2162. return -ENOSYS;
  2163. }
  2164. int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  2165. struct file *filp,
  2166. void __user *buffer,
  2167. size_t *lenp, loff_t *ppos)
  2168. {
  2169. return -ENOSYS;
  2170. }
  2171. #endif /* CONFIG_PROC_FS */
  2172. #ifdef CONFIG_SYSCTL_SYSCALL
  2173. /*
  2174. * General sysctl support routines
  2175. */
  2176. /* The generic string strategy routine: */
  2177. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2178. void __user *oldval, size_t __user *oldlenp,
  2179. void __user *newval, size_t newlen)
  2180. {
  2181. if (!table->data || !table->maxlen)
  2182. return -ENOTDIR;
  2183. if (oldval && oldlenp) {
  2184. size_t bufsize;
  2185. if (get_user(bufsize, oldlenp))
  2186. return -EFAULT;
  2187. if (bufsize) {
  2188. size_t len = strlen(table->data), copied;
  2189. /* This shouldn't trigger for a well-formed sysctl */
  2190. if (len > table->maxlen)
  2191. len = table->maxlen;
  2192. /* Copy up to a max of bufsize-1 bytes of the string */
  2193. copied = (len >= bufsize) ? bufsize - 1 : len;
  2194. if (copy_to_user(oldval, table->data, copied) ||
  2195. put_user(0, (char __user *)(oldval + copied)))
  2196. return -EFAULT;
  2197. if (put_user(len, oldlenp))
  2198. return -EFAULT;
  2199. }
  2200. }
  2201. if (newval && newlen) {
  2202. size_t len = newlen;
  2203. if (len > table->maxlen)
  2204. len = table->maxlen;
  2205. if(copy_from_user(table->data, newval, len))
  2206. return -EFAULT;
  2207. if (len == table->maxlen)
  2208. len--;
  2209. ((char *) table->data)[len] = 0;
  2210. }
  2211. return 1;
  2212. }
  2213. /*
  2214. * This function makes sure that all of the integers in the vector
  2215. * are between the minimum and maximum values given in the arrays
  2216. * table->extra1 and table->extra2, respectively.
  2217. */
  2218. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2219. void __user *oldval, size_t __user *oldlenp,
  2220. void __user *newval, size_t newlen)
  2221. {
  2222. if (newval && newlen) {
  2223. int __user *vec = (int __user *) newval;
  2224. int *min = (int *) table->extra1;
  2225. int *max = (int *) table->extra2;
  2226. size_t length;
  2227. int i;
  2228. if (newlen % sizeof(int) != 0)
  2229. return -EINVAL;
  2230. if (!table->extra1 && !table->extra2)
  2231. return 0;
  2232. if (newlen > table->maxlen)
  2233. newlen = table->maxlen;
  2234. length = newlen / sizeof(int);
  2235. for (i = 0; i < length; i++) {
  2236. int value;
  2237. if (get_user(value, vec + i))
  2238. return -EFAULT;
  2239. if (min && value < min[i])
  2240. return -EINVAL;
  2241. if (max && value > max[i])
  2242. return -EINVAL;
  2243. }
  2244. }
  2245. return 0;
  2246. }
  2247. /* Strategy function to convert jiffies to seconds */
  2248. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2249. void __user *oldval, size_t __user *oldlenp,
  2250. void __user *newval, size_t newlen)
  2251. {
  2252. if (oldval && oldlenp) {
  2253. size_t olen;
  2254. if (get_user(olen, oldlenp))
  2255. return -EFAULT;
  2256. if (olen) {
  2257. int val;
  2258. if (olen < sizeof(int))
  2259. return -EINVAL;
  2260. val = *(int *)(table->data) / HZ;
  2261. if (put_user(val, (int __user *)oldval))
  2262. return -EFAULT;
  2263. if (put_user(sizeof(int), oldlenp))
  2264. return -EFAULT;
  2265. }
  2266. }
  2267. if (newval && newlen) {
  2268. int new;
  2269. if (newlen != sizeof(int))
  2270. return -EINVAL;
  2271. if (get_user(new, (int __user *)newval))
  2272. return -EFAULT;
  2273. *(int *)(table->data) = new*HZ;
  2274. }
  2275. return 1;
  2276. }
  2277. /* Strategy function to convert jiffies to seconds */
  2278. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2279. void __user *oldval, size_t __user *oldlenp,
  2280. void __user *newval, size_t newlen)
  2281. {
  2282. if (oldval && oldlenp) {
  2283. size_t olen;
  2284. if (get_user(olen, oldlenp))
  2285. return -EFAULT;
  2286. if (olen) {
  2287. int val;
  2288. if (olen < sizeof(int))
  2289. return -EINVAL;
  2290. val = jiffies_to_msecs(*(int *)(table->data));
  2291. if (put_user(val, (int __user *)oldval))
  2292. return -EFAULT;
  2293. if (put_user(sizeof(int), oldlenp))
  2294. return -EFAULT;
  2295. }
  2296. }
  2297. if (newval && newlen) {
  2298. int new;
  2299. if (newlen != sizeof(int))
  2300. return -EINVAL;
  2301. if (get_user(new, (int __user *)newval))
  2302. return -EFAULT;
  2303. *(int *)(table->data) = msecs_to_jiffies(new);
  2304. }
  2305. return 1;
  2306. }
  2307. #else /* CONFIG_SYSCTL_SYSCALL */
  2308. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  2309. {
  2310. static int msg_count;
  2311. struct __sysctl_args tmp;
  2312. int name[CTL_MAXNAME];
  2313. int i;
  2314. /* Read in the sysctl name for better debug message logging */
  2315. if (copy_from_user(&tmp, args, sizeof(tmp)))
  2316. return -EFAULT;
  2317. if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
  2318. return -ENOTDIR;
  2319. for (i = 0; i < tmp.nlen; i++)
  2320. if (get_user(name[i], tmp.name + i))
  2321. return -EFAULT;
  2322. /* Ignore accesses to kernel.version */
  2323. if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
  2324. goto out;
  2325. if (msg_count < 5) {
  2326. msg_count++;
  2327. printk(KERN_INFO
  2328. "warning: process `%s' used the removed sysctl "
  2329. "system call with ", current->comm);
  2330. for (i = 0; i < tmp.nlen; i++)
  2331. printk("%d.", name[i]);
  2332. printk("\n");
  2333. }
  2334. out:
  2335. return -ENOSYS;
  2336. }
  2337. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2338. void __user *oldval, size_t __user *oldlenp,
  2339. void __user *newval, size_t newlen)
  2340. {
  2341. return -ENOSYS;
  2342. }
  2343. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2344. void __user *oldval, size_t __user *oldlenp,
  2345. void __user *newval, size_t newlen)
  2346. {
  2347. return -ENOSYS;
  2348. }
  2349. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2350. void __user *oldval, size_t __user *oldlenp,
  2351. void __user *newval, size_t newlen)
  2352. {
  2353. return -ENOSYS;
  2354. }
  2355. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2356. void __user *oldval, size_t __user *oldlenp,
  2357. void __user *newval, size_t newlen)
  2358. {
  2359. return -ENOSYS;
  2360. }
  2361. #endif /* CONFIG_SYSCTL_SYSCALL */
  2362. /*
  2363. * No sense putting this after each symbol definition, twice,
  2364. * exception granted :-)
  2365. */
  2366. EXPORT_SYMBOL(proc_dointvec);
  2367. EXPORT_SYMBOL(proc_dointvec_jiffies);
  2368. EXPORT_SYMBOL(proc_dointvec_minmax);
  2369. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  2370. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  2371. EXPORT_SYMBOL(proc_dostring);
  2372. EXPORT_SYMBOL(proc_doulongvec_minmax);
  2373. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
  2374. EXPORT_SYMBOL(register_sysctl_table);
  2375. EXPORT_SYMBOL(sysctl_intvec);
  2376. EXPORT_SYMBOL(sysctl_jiffies);
  2377. EXPORT_SYMBOL(sysctl_ms_jiffies);
  2378. EXPORT_SYMBOL(sysctl_string);
  2379. EXPORT_SYMBOL(unregister_sysctl_table);