sysctl.c 61 KB

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