sysctl.c 61 KB

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