sysctl.c 60 KB

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