sysctl.c 60 KB

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