sysctl.c 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572
  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. /*
  726. * NOTE: do not add new entries to this table unless you have read
  727. * Documentation/sysctl/ctl_unnumbered.txt
  728. */
  729. { .ctl_name = 0 }
  730. };
  731. /* Constants for minimum and maximum testing in vm_table.
  732. We use these as one-element integer vectors. */
  733. static int zero;
  734. static int two = 2;
  735. static int one_hundred = 100;
  736. static ctl_table vm_table[] = {
  737. {
  738. .ctl_name = VM_OVERCOMMIT_MEMORY,
  739. .procname = "overcommit_memory",
  740. .data = &sysctl_overcommit_memory,
  741. .maxlen = sizeof(sysctl_overcommit_memory),
  742. .mode = 0644,
  743. .proc_handler = &proc_dointvec,
  744. },
  745. {
  746. .ctl_name = VM_PANIC_ON_OOM,
  747. .procname = "panic_on_oom",
  748. .data = &sysctl_panic_on_oom,
  749. .maxlen = sizeof(sysctl_panic_on_oom),
  750. .mode = 0644,
  751. .proc_handler = &proc_dointvec,
  752. },
  753. {
  754. .ctl_name = VM_OVERCOMMIT_RATIO,
  755. .procname = "overcommit_ratio",
  756. .data = &sysctl_overcommit_ratio,
  757. .maxlen = sizeof(sysctl_overcommit_ratio),
  758. .mode = 0644,
  759. .proc_handler = &proc_dointvec,
  760. },
  761. {
  762. .ctl_name = VM_PAGE_CLUSTER,
  763. .procname = "page-cluster",
  764. .data = &page_cluster,
  765. .maxlen = sizeof(int),
  766. .mode = 0644,
  767. .proc_handler = &proc_dointvec,
  768. },
  769. {
  770. .ctl_name = VM_DIRTY_BACKGROUND,
  771. .procname = "dirty_background_ratio",
  772. .data = &dirty_background_ratio,
  773. .maxlen = sizeof(dirty_background_ratio),
  774. .mode = 0644,
  775. .proc_handler = &proc_dointvec_minmax,
  776. .strategy = &sysctl_intvec,
  777. .extra1 = &zero,
  778. .extra2 = &one_hundred,
  779. },
  780. {
  781. .ctl_name = VM_DIRTY_RATIO,
  782. .procname = "dirty_ratio",
  783. .data = &vm_dirty_ratio,
  784. .maxlen = sizeof(vm_dirty_ratio),
  785. .mode = 0644,
  786. .proc_handler = &proc_dointvec_minmax,
  787. .strategy = &sysctl_intvec,
  788. .extra1 = &zero,
  789. .extra2 = &one_hundred,
  790. },
  791. {
  792. .ctl_name = VM_DIRTY_WB_CS,
  793. .procname = "dirty_writeback_centisecs",
  794. .data = &dirty_writeback_interval,
  795. .maxlen = sizeof(dirty_writeback_interval),
  796. .mode = 0644,
  797. .proc_handler = &dirty_writeback_centisecs_handler,
  798. },
  799. {
  800. .ctl_name = VM_DIRTY_EXPIRE_CS,
  801. .procname = "dirty_expire_centisecs",
  802. .data = &dirty_expire_interval,
  803. .maxlen = sizeof(dirty_expire_interval),
  804. .mode = 0644,
  805. .proc_handler = &proc_dointvec_userhz_jiffies,
  806. },
  807. {
  808. .ctl_name = VM_NR_PDFLUSH_THREADS,
  809. .procname = "nr_pdflush_threads",
  810. .data = &nr_pdflush_threads,
  811. .maxlen = sizeof nr_pdflush_threads,
  812. .mode = 0444 /* read-only*/,
  813. .proc_handler = &proc_dointvec,
  814. },
  815. {
  816. .ctl_name = VM_SWAPPINESS,
  817. .procname = "swappiness",
  818. .data = &vm_swappiness,
  819. .maxlen = sizeof(vm_swappiness),
  820. .mode = 0644,
  821. .proc_handler = &proc_dointvec_minmax,
  822. .strategy = &sysctl_intvec,
  823. .extra1 = &zero,
  824. .extra2 = &one_hundred,
  825. },
  826. #ifdef CONFIG_HUGETLB_PAGE
  827. {
  828. .ctl_name = VM_HUGETLB_PAGES,
  829. .procname = "nr_hugepages",
  830. .data = &max_huge_pages,
  831. .maxlen = sizeof(unsigned long),
  832. .mode = 0644,
  833. .proc_handler = &hugetlb_sysctl_handler,
  834. .extra1 = (void *)&hugetlb_zero,
  835. .extra2 = (void *)&hugetlb_infinity,
  836. },
  837. {
  838. .ctl_name = VM_HUGETLB_GROUP,
  839. .procname = "hugetlb_shm_group",
  840. .data = &sysctl_hugetlb_shm_group,
  841. .maxlen = sizeof(gid_t),
  842. .mode = 0644,
  843. .proc_handler = &proc_dointvec,
  844. },
  845. {
  846. .ctl_name = CTL_UNNUMBERED,
  847. .procname = "hugepages_treat_as_movable",
  848. .data = &hugepages_treat_as_movable,
  849. .maxlen = sizeof(int),
  850. .mode = 0644,
  851. .proc_handler = &hugetlb_treat_movable_handler,
  852. },
  853. #endif
  854. {
  855. .ctl_name = VM_LOWMEM_RESERVE_RATIO,
  856. .procname = "lowmem_reserve_ratio",
  857. .data = &sysctl_lowmem_reserve_ratio,
  858. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  859. .mode = 0644,
  860. .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
  861. .strategy = &sysctl_intvec,
  862. },
  863. {
  864. .ctl_name = VM_DROP_PAGECACHE,
  865. .procname = "drop_caches",
  866. .data = &sysctl_drop_caches,
  867. .maxlen = sizeof(int),
  868. .mode = 0644,
  869. .proc_handler = drop_caches_sysctl_handler,
  870. .strategy = &sysctl_intvec,
  871. },
  872. {
  873. .ctl_name = VM_MIN_FREE_KBYTES,
  874. .procname = "min_free_kbytes",
  875. .data = &min_free_kbytes,
  876. .maxlen = sizeof(min_free_kbytes),
  877. .mode = 0644,
  878. .proc_handler = &min_free_kbytes_sysctl_handler,
  879. .strategy = &sysctl_intvec,
  880. .extra1 = &zero,
  881. },
  882. {
  883. .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
  884. .procname = "percpu_pagelist_fraction",
  885. .data = &percpu_pagelist_fraction,
  886. .maxlen = sizeof(percpu_pagelist_fraction),
  887. .mode = 0644,
  888. .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
  889. .strategy = &sysctl_intvec,
  890. .extra1 = &min_percpu_pagelist_fract,
  891. },
  892. #ifdef CONFIG_MMU
  893. {
  894. .ctl_name = VM_MAX_MAP_COUNT,
  895. .procname = "max_map_count",
  896. .data = &sysctl_max_map_count,
  897. .maxlen = sizeof(sysctl_max_map_count),
  898. .mode = 0644,
  899. .proc_handler = &proc_dointvec
  900. },
  901. #endif
  902. {
  903. .ctl_name = VM_LAPTOP_MODE,
  904. .procname = "laptop_mode",
  905. .data = &laptop_mode,
  906. .maxlen = sizeof(laptop_mode),
  907. .mode = 0644,
  908. .proc_handler = &proc_dointvec_jiffies,
  909. .strategy = &sysctl_jiffies,
  910. },
  911. {
  912. .ctl_name = VM_BLOCK_DUMP,
  913. .procname = "block_dump",
  914. .data = &block_dump,
  915. .maxlen = sizeof(block_dump),
  916. .mode = 0644,
  917. .proc_handler = &proc_dointvec,
  918. .strategy = &sysctl_intvec,
  919. .extra1 = &zero,
  920. },
  921. {
  922. .ctl_name = VM_VFS_CACHE_PRESSURE,
  923. .procname = "vfs_cache_pressure",
  924. .data = &sysctl_vfs_cache_pressure,
  925. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  926. .mode = 0644,
  927. .proc_handler = &proc_dointvec,
  928. .strategy = &sysctl_intvec,
  929. .extra1 = &zero,
  930. },
  931. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  932. {
  933. .ctl_name = VM_LEGACY_VA_LAYOUT,
  934. .procname = "legacy_va_layout",
  935. .data = &sysctl_legacy_va_layout,
  936. .maxlen = sizeof(sysctl_legacy_va_layout),
  937. .mode = 0644,
  938. .proc_handler = &proc_dointvec,
  939. .strategy = &sysctl_intvec,
  940. .extra1 = &zero,
  941. },
  942. #endif
  943. #ifdef CONFIG_NUMA
  944. {
  945. .ctl_name = VM_ZONE_RECLAIM_MODE,
  946. .procname = "zone_reclaim_mode",
  947. .data = &zone_reclaim_mode,
  948. .maxlen = sizeof(zone_reclaim_mode),
  949. .mode = 0644,
  950. .proc_handler = &proc_dointvec,
  951. .strategy = &sysctl_intvec,
  952. .extra1 = &zero,
  953. },
  954. {
  955. .ctl_name = VM_MIN_UNMAPPED,
  956. .procname = "min_unmapped_ratio",
  957. .data = &sysctl_min_unmapped_ratio,
  958. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  959. .mode = 0644,
  960. .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
  961. .strategy = &sysctl_intvec,
  962. .extra1 = &zero,
  963. .extra2 = &one_hundred,
  964. },
  965. {
  966. .ctl_name = VM_MIN_SLAB,
  967. .procname = "min_slab_ratio",
  968. .data = &sysctl_min_slab_ratio,
  969. .maxlen = sizeof(sysctl_min_slab_ratio),
  970. .mode = 0644,
  971. .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
  972. .strategy = &sysctl_intvec,
  973. .extra1 = &zero,
  974. .extra2 = &one_hundred,
  975. },
  976. #endif
  977. #ifdef CONFIG_SMP
  978. {
  979. .ctl_name = CTL_UNNUMBERED,
  980. .procname = "stat_interval",
  981. .data = &sysctl_stat_interval,
  982. .maxlen = sizeof(sysctl_stat_interval),
  983. .mode = 0644,
  984. .proc_handler = &proc_dointvec_jiffies,
  985. .strategy = &sysctl_jiffies,
  986. },
  987. #endif
  988. #ifdef CONFIG_SECURITY
  989. {
  990. .ctl_name = CTL_UNNUMBERED,
  991. .procname = "mmap_min_addr",
  992. .data = &mmap_min_addr,
  993. .maxlen = sizeof(unsigned long),
  994. .mode = 0644,
  995. .proc_handler = &proc_doulongvec_minmax,
  996. },
  997. #ifdef CONFIG_NUMA
  998. {
  999. .ctl_name = CTL_UNNUMBERED,
  1000. .procname = "numa_zonelist_order",
  1001. .data = &numa_zonelist_order,
  1002. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  1003. .mode = 0644,
  1004. .proc_handler = &numa_zonelist_order_handler,
  1005. .strategy = &sysctl_string,
  1006. },
  1007. #endif
  1008. #endif
  1009. #if defined(CONFIG_X86_32) || \
  1010. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  1011. {
  1012. .ctl_name = VM_VDSO_ENABLED,
  1013. .procname = "vdso_enabled",
  1014. .data = &vdso_enabled,
  1015. .maxlen = sizeof(vdso_enabled),
  1016. .mode = 0644,
  1017. .proc_handler = &proc_dointvec,
  1018. .strategy = &sysctl_intvec,
  1019. .extra1 = &zero,
  1020. },
  1021. #endif
  1022. /*
  1023. * NOTE: do not add new entries to this table unless you have read
  1024. * Documentation/sysctl/ctl_unnumbered.txt
  1025. */
  1026. { .ctl_name = 0 }
  1027. };
  1028. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1029. static ctl_table binfmt_misc_table[] = {
  1030. { .ctl_name = 0 }
  1031. };
  1032. #endif
  1033. static ctl_table fs_table[] = {
  1034. {
  1035. .ctl_name = FS_NRINODE,
  1036. .procname = "inode-nr",
  1037. .data = &inodes_stat,
  1038. .maxlen = 2*sizeof(int),
  1039. .mode = 0444,
  1040. .proc_handler = &proc_dointvec,
  1041. },
  1042. {
  1043. .ctl_name = FS_STATINODE,
  1044. .procname = "inode-state",
  1045. .data = &inodes_stat,
  1046. .maxlen = 7*sizeof(int),
  1047. .mode = 0444,
  1048. .proc_handler = &proc_dointvec,
  1049. },
  1050. {
  1051. .ctl_name = FS_NRFILE,
  1052. .procname = "file-nr",
  1053. .data = &files_stat,
  1054. .maxlen = 3*sizeof(int),
  1055. .mode = 0444,
  1056. .proc_handler = &proc_nr_files,
  1057. },
  1058. {
  1059. .ctl_name = FS_MAXFILE,
  1060. .procname = "file-max",
  1061. .data = &files_stat.max_files,
  1062. .maxlen = sizeof(int),
  1063. .mode = 0644,
  1064. .proc_handler = &proc_dointvec,
  1065. },
  1066. {
  1067. .ctl_name = FS_DENTRY,
  1068. .procname = "dentry-state",
  1069. .data = &dentry_stat,
  1070. .maxlen = 6*sizeof(int),
  1071. .mode = 0444,
  1072. .proc_handler = &proc_dointvec,
  1073. },
  1074. {
  1075. .ctl_name = FS_OVERFLOWUID,
  1076. .procname = "overflowuid",
  1077. .data = &fs_overflowuid,
  1078. .maxlen = sizeof(int),
  1079. .mode = 0644,
  1080. .proc_handler = &proc_dointvec_minmax,
  1081. .strategy = &sysctl_intvec,
  1082. .extra1 = &minolduid,
  1083. .extra2 = &maxolduid,
  1084. },
  1085. {
  1086. .ctl_name = FS_OVERFLOWGID,
  1087. .procname = "overflowgid",
  1088. .data = &fs_overflowgid,
  1089. .maxlen = sizeof(int),
  1090. .mode = 0644,
  1091. .proc_handler = &proc_dointvec_minmax,
  1092. .strategy = &sysctl_intvec,
  1093. .extra1 = &minolduid,
  1094. .extra2 = &maxolduid,
  1095. },
  1096. {
  1097. .ctl_name = FS_LEASES,
  1098. .procname = "leases-enable",
  1099. .data = &leases_enable,
  1100. .maxlen = sizeof(int),
  1101. .mode = 0644,
  1102. .proc_handler = &proc_dointvec,
  1103. },
  1104. #ifdef CONFIG_DNOTIFY
  1105. {
  1106. .ctl_name = FS_DIR_NOTIFY,
  1107. .procname = "dir-notify-enable",
  1108. .data = &dir_notify_enable,
  1109. .maxlen = sizeof(int),
  1110. .mode = 0644,
  1111. .proc_handler = &proc_dointvec,
  1112. },
  1113. #endif
  1114. #ifdef CONFIG_MMU
  1115. {
  1116. .ctl_name = FS_LEASE_TIME,
  1117. .procname = "lease-break-time",
  1118. .data = &lease_break_time,
  1119. .maxlen = sizeof(int),
  1120. .mode = 0644,
  1121. .proc_handler = &proc_dointvec_minmax,
  1122. .strategy = &sysctl_intvec,
  1123. .extra1 = &zero,
  1124. .extra2 = &two,
  1125. },
  1126. {
  1127. .ctl_name = FS_AIO_NR,
  1128. .procname = "aio-nr",
  1129. .data = &aio_nr,
  1130. .maxlen = sizeof(aio_nr),
  1131. .mode = 0444,
  1132. .proc_handler = &proc_doulongvec_minmax,
  1133. },
  1134. {
  1135. .ctl_name = FS_AIO_MAX_NR,
  1136. .procname = "aio-max-nr",
  1137. .data = &aio_max_nr,
  1138. .maxlen = sizeof(aio_max_nr),
  1139. .mode = 0644,
  1140. .proc_handler = &proc_doulongvec_minmax,
  1141. },
  1142. #ifdef CONFIG_INOTIFY_USER
  1143. {
  1144. .ctl_name = FS_INOTIFY,
  1145. .procname = "inotify",
  1146. .mode = 0555,
  1147. .child = inotify_table,
  1148. },
  1149. #endif
  1150. #endif
  1151. {
  1152. .ctl_name = KERN_SETUID_DUMPABLE,
  1153. .procname = "suid_dumpable",
  1154. .data = &suid_dumpable,
  1155. .maxlen = sizeof(int),
  1156. .mode = 0644,
  1157. .proc_handler = &proc_dointvec,
  1158. },
  1159. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1160. {
  1161. .ctl_name = CTL_UNNUMBERED,
  1162. .procname = "binfmt_misc",
  1163. .mode = 0555,
  1164. .child = binfmt_misc_table,
  1165. },
  1166. #endif
  1167. /*
  1168. * NOTE: do not add new entries to this table unless you have read
  1169. * Documentation/sysctl/ctl_unnumbered.txt
  1170. */
  1171. { .ctl_name = 0 }
  1172. };
  1173. static ctl_table debug_table[] = {
  1174. { .ctl_name = 0 }
  1175. };
  1176. static ctl_table dev_table[] = {
  1177. { .ctl_name = 0 }
  1178. };
  1179. static DEFINE_SPINLOCK(sysctl_lock);
  1180. /* called under sysctl_lock */
  1181. static int use_table(struct ctl_table_header *p)
  1182. {
  1183. if (unlikely(p->unregistering))
  1184. return 0;
  1185. p->used++;
  1186. return 1;
  1187. }
  1188. /* called under sysctl_lock */
  1189. static void unuse_table(struct ctl_table_header *p)
  1190. {
  1191. if (!--p->used)
  1192. if (unlikely(p->unregistering))
  1193. complete(p->unregistering);
  1194. }
  1195. /* called under sysctl_lock, will reacquire if has to wait */
  1196. static void start_unregistering(struct ctl_table_header *p)
  1197. {
  1198. /*
  1199. * if p->used is 0, nobody will ever touch that entry again;
  1200. * we'll eliminate all paths to it before dropping sysctl_lock
  1201. */
  1202. if (unlikely(p->used)) {
  1203. struct completion wait;
  1204. init_completion(&wait);
  1205. p->unregistering = &wait;
  1206. spin_unlock(&sysctl_lock);
  1207. wait_for_completion(&wait);
  1208. spin_lock(&sysctl_lock);
  1209. }
  1210. /*
  1211. * do not remove from the list until nobody holds it; walking the
  1212. * list in do_sysctl() relies on that.
  1213. */
  1214. list_del_init(&p->ctl_entry);
  1215. }
  1216. void sysctl_head_finish(struct ctl_table_header *head)
  1217. {
  1218. if (!head)
  1219. return;
  1220. spin_lock(&sysctl_lock);
  1221. unuse_table(head);
  1222. spin_unlock(&sysctl_lock);
  1223. }
  1224. struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
  1225. {
  1226. struct ctl_table_header *head;
  1227. struct list_head *tmp;
  1228. spin_lock(&sysctl_lock);
  1229. if (prev) {
  1230. tmp = &prev->ctl_entry;
  1231. unuse_table(prev);
  1232. goto next;
  1233. }
  1234. tmp = &root_table_header.ctl_entry;
  1235. for (;;) {
  1236. head = list_entry(tmp, struct ctl_table_header, ctl_entry);
  1237. if (!use_table(head))
  1238. goto next;
  1239. spin_unlock(&sysctl_lock);
  1240. return head;
  1241. next:
  1242. tmp = tmp->next;
  1243. if (tmp == &root_table_header.ctl_entry)
  1244. break;
  1245. }
  1246. spin_unlock(&sysctl_lock);
  1247. return NULL;
  1248. }
  1249. #ifdef CONFIG_SYSCTL_SYSCALL
  1250. int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
  1251. void __user *newval, size_t newlen)
  1252. {
  1253. struct ctl_table_header *head;
  1254. int error = -ENOTDIR;
  1255. if (nlen <= 0 || nlen >= CTL_MAXNAME)
  1256. return -ENOTDIR;
  1257. if (oldval) {
  1258. int old_len;
  1259. if (!oldlenp || get_user(old_len, oldlenp))
  1260. return -EFAULT;
  1261. }
  1262. for (head = sysctl_head_next(NULL); head;
  1263. head = sysctl_head_next(head)) {
  1264. error = parse_table(name, nlen, oldval, oldlenp,
  1265. newval, newlen, head->ctl_table);
  1266. if (error != -ENOTDIR) {
  1267. sysctl_head_finish(head);
  1268. break;
  1269. }
  1270. }
  1271. return error;
  1272. }
  1273. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  1274. {
  1275. struct __sysctl_args tmp;
  1276. int error;
  1277. if (copy_from_user(&tmp, args, sizeof(tmp)))
  1278. return -EFAULT;
  1279. lock_kernel();
  1280. error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
  1281. tmp.newval, tmp.newlen);
  1282. unlock_kernel();
  1283. return error;
  1284. }
  1285. #endif /* CONFIG_SYSCTL_SYSCALL */
  1286. /*
  1287. * sysctl_perm does NOT grant the superuser all rights automatically, because
  1288. * some sysctl variables are readonly even to root.
  1289. */
  1290. static int test_perm(int mode, int op)
  1291. {
  1292. if (!current->euid)
  1293. mode >>= 6;
  1294. else if (in_egroup_p(0))
  1295. mode >>= 3;
  1296. if ((mode & op & 0007) == op)
  1297. return 0;
  1298. return -EACCES;
  1299. }
  1300. int sysctl_perm(ctl_table *table, int op)
  1301. {
  1302. int error;
  1303. error = security_sysctl(table, op);
  1304. if (error)
  1305. return error;
  1306. return test_perm(table->mode, op);
  1307. }
  1308. #ifdef CONFIG_SYSCTL_SYSCALL
  1309. static int parse_table(int __user *name, int nlen,
  1310. void __user *oldval, size_t __user *oldlenp,
  1311. void __user *newval, size_t newlen,
  1312. ctl_table *table)
  1313. {
  1314. int n;
  1315. repeat:
  1316. if (!nlen)
  1317. return -ENOTDIR;
  1318. if (get_user(n, name))
  1319. return -EFAULT;
  1320. for ( ; table->ctl_name || table->procname; table++) {
  1321. if (!table->ctl_name)
  1322. continue;
  1323. if (n == table->ctl_name) {
  1324. int error;
  1325. if (table->child) {
  1326. if (sysctl_perm(table, 001))
  1327. return -EPERM;
  1328. name++;
  1329. nlen--;
  1330. table = table->child;
  1331. goto repeat;
  1332. }
  1333. error = do_sysctl_strategy(table, name, nlen,
  1334. oldval, oldlenp,
  1335. newval, newlen);
  1336. return error;
  1337. }
  1338. }
  1339. return -ENOTDIR;
  1340. }
  1341. /* Perform the actual read/write of a sysctl table entry. */
  1342. int do_sysctl_strategy (ctl_table *table,
  1343. int __user *name, int nlen,
  1344. void __user *oldval, size_t __user *oldlenp,
  1345. void __user *newval, size_t newlen)
  1346. {
  1347. int op = 0, rc;
  1348. size_t len;
  1349. if (oldval)
  1350. op |= 004;
  1351. if (newval)
  1352. op |= 002;
  1353. if (sysctl_perm(table, op))
  1354. return -EPERM;
  1355. if (table->strategy) {
  1356. rc = table->strategy(table, name, nlen, oldval, oldlenp,
  1357. newval, newlen);
  1358. if (rc < 0)
  1359. return rc;
  1360. if (rc > 0)
  1361. return 0;
  1362. }
  1363. /* If there is no strategy routine, or if the strategy returns
  1364. * zero, proceed with automatic r/w */
  1365. if (table->data && table->maxlen) {
  1366. if (oldval && oldlenp) {
  1367. if (get_user(len, oldlenp))
  1368. return -EFAULT;
  1369. if (len) {
  1370. if (len > table->maxlen)
  1371. len = table->maxlen;
  1372. if(copy_to_user(oldval, table->data, len))
  1373. return -EFAULT;
  1374. if(put_user(len, oldlenp))
  1375. return -EFAULT;
  1376. }
  1377. }
  1378. if (newval && newlen) {
  1379. len = newlen;
  1380. if (len > table->maxlen)
  1381. len = table->maxlen;
  1382. if(copy_from_user(table->data, newval, len))
  1383. return -EFAULT;
  1384. }
  1385. }
  1386. return 0;
  1387. }
  1388. #endif /* CONFIG_SYSCTL_SYSCALL */
  1389. static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
  1390. {
  1391. for (; table->ctl_name || table->procname; table++) {
  1392. table->parent = parent;
  1393. if (table->child)
  1394. sysctl_set_parent(table, table->child);
  1395. }
  1396. }
  1397. static __init int sysctl_init(void)
  1398. {
  1399. sysctl_set_parent(NULL, root_table);
  1400. return 0;
  1401. }
  1402. core_initcall(sysctl_init);
  1403. /**
  1404. * register_sysctl_table - register a sysctl hierarchy
  1405. * @table: the top-level table structure
  1406. *
  1407. * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  1408. * array. An entry with a ctl_name of 0 terminates the table.
  1409. *
  1410. * The members of the &ctl_table structure are used as follows:
  1411. *
  1412. * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
  1413. * must be unique within that level of sysctl
  1414. *
  1415. * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
  1416. * enter a sysctl file
  1417. *
  1418. * data - a pointer to data for use by proc_handler
  1419. *
  1420. * maxlen - the maximum size in bytes of the data
  1421. *
  1422. * mode - the file permissions for the /proc/sys file, and for sysctl(2)
  1423. *
  1424. * child - a pointer to the child sysctl table if this entry is a directory, or
  1425. * %NULL.
  1426. *
  1427. * proc_handler - the text handler routine (described below)
  1428. *
  1429. * strategy - the strategy routine (described below)
  1430. *
  1431. * de - for internal use by the sysctl routines
  1432. *
  1433. * extra1, extra2 - extra pointers usable by the proc handler routines
  1434. *
  1435. * Leaf nodes in the sysctl tree will be represented by a single file
  1436. * under /proc; non-leaf nodes will be represented by directories.
  1437. *
  1438. * sysctl(2) can automatically manage read and write requests through
  1439. * the sysctl table. The data and maxlen fields of the ctl_table
  1440. * struct enable minimal validation of the values being written to be
  1441. * performed, and the mode field allows minimal authentication.
  1442. *
  1443. * More sophisticated management can be enabled by the provision of a
  1444. * strategy routine with the table entry. This will be called before
  1445. * any automatic read or write of the data is performed.
  1446. *
  1447. * The strategy routine may return
  1448. *
  1449. * < 0 - Error occurred (error is passed to user process)
  1450. *
  1451. * 0 - OK - proceed with automatic read or write.
  1452. *
  1453. * > 0 - OK - read or write has been done by the strategy routine, so
  1454. * return immediately.
  1455. *
  1456. * There must be a proc_handler routine for any terminal nodes
  1457. * mirrored under /proc/sys (non-terminals are handled by a built-in
  1458. * directory handler). Several default handlers are available to
  1459. * cover common cases -
  1460. *
  1461. * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
  1462. * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
  1463. * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
  1464. *
  1465. * It is the handler's job to read the input buffer from user memory
  1466. * and process it. The handler should return 0 on success.
  1467. *
  1468. * This routine returns %NULL on a failure to register, and a pointer
  1469. * to the table header on success.
  1470. */
  1471. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1472. {
  1473. struct ctl_table_header *tmp;
  1474. tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
  1475. if (!tmp)
  1476. return NULL;
  1477. tmp->ctl_table = table;
  1478. INIT_LIST_HEAD(&tmp->ctl_entry);
  1479. tmp->used = 0;
  1480. tmp->unregistering = NULL;
  1481. sysctl_set_parent(NULL, table);
  1482. spin_lock(&sysctl_lock);
  1483. list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
  1484. spin_unlock(&sysctl_lock);
  1485. return tmp;
  1486. }
  1487. /**
  1488. * unregister_sysctl_table - unregister a sysctl table hierarchy
  1489. * @header: the header returned from register_sysctl_table
  1490. *
  1491. * Unregisters the sysctl table and all children. proc entries may not
  1492. * actually be removed until they are no longer used by anyone.
  1493. */
  1494. void unregister_sysctl_table(struct ctl_table_header * header)
  1495. {
  1496. might_sleep();
  1497. spin_lock(&sysctl_lock);
  1498. start_unregistering(header);
  1499. spin_unlock(&sysctl_lock);
  1500. kfree(header);
  1501. }
  1502. #else /* !CONFIG_SYSCTL */
  1503. struct ctl_table_header *register_sysctl_table(ctl_table * table)
  1504. {
  1505. return NULL;
  1506. }
  1507. void unregister_sysctl_table(struct ctl_table_header * table)
  1508. {
  1509. }
  1510. #endif /* CONFIG_SYSCTL */
  1511. /*
  1512. * /proc/sys support
  1513. */
  1514. #ifdef CONFIG_PROC_SYSCTL
  1515. static int _proc_do_string(void* data, int maxlen, int write,
  1516. struct file *filp, void __user *buffer,
  1517. size_t *lenp, loff_t *ppos)
  1518. {
  1519. size_t len;
  1520. char __user *p;
  1521. char c;
  1522. if (!data || !maxlen || !*lenp) {
  1523. *lenp = 0;
  1524. return 0;
  1525. }
  1526. if (write) {
  1527. len = 0;
  1528. p = buffer;
  1529. while (len < *lenp) {
  1530. if (get_user(c, p++))
  1531. return -EFAULT;
  1532. if (c == 0 || c == '\n')
  1533. break;
  1534. len++;
  1535. }
  1536. if (len >= maxlen)
  1537. len = maxlen-1;
  1538. if(copy_from_user(data, buffer, len))
  1539. return -EFAULT;
  1540. ((char *) data)[len] = 0;
  1541. *ppos += *lenp;
  1542. } else {
  1543. len = strlen(data);
  1544. if (len > maxlen)
  1545. len = maxlen;
  1546. if (*ppos > len) {
  1547. *lenp = 0;
  1548. return 0;
  1549. }
  1550. data += *ppos;
  1551. len -= *ppos;
  1552. if (len > *lenp)
  1553. len = *lenp;
  1554. if (len)
  1555. if(copy_to_user(buffer, data, len))
  1556. return -EFAULT;
  1557. if (len < *lenp) {
  1558. if(put_user('\n', ((char __user *) buffer) + len))
  1559. return -EFAULT;
  1560. len++;
  1561. }
  1562. *lenp = len;
  1563. *ppos += len;
  1564. }
  1565. return 0;
  1566. }
  1567. /**
  1568. * proc_dostring - read a string sysctl
  1569. * @table: the sysctl table
  1570. * @write: %TRUE if this is a write to the sysctl file
  1571. * @filp: the file structure
  1572. * @buffer: the user buffer
  1573. * @lenp: the size of the user buffer
  1574. * @ppos: file position
  1575. *
  1576. * Reads/writes a string from/to the user buffer. If the kernel
  1577. * buffer provided is not large enough to hold the string, the
  1578. * string is truncated. The copied string is %NULL-terminated.
  1579. * If the string is being read by the user process, it is copied
  1580. * and a newline '\n' is added. It is truncated if the buffer is
  1581. * not large enough.
  1582. *
  1583. * Returns 0 on success.
  1584. */
  1585. int proc_dostring(ctl_table *table, int write, struct file *filp,
  1586. void __user *buffer, size_t *lenp, loff_t *ppos)
  1587. {
  1588. return _proc_do_string(table->data, table->maxlen, write, filp,
  1589. buffer, lenp, ppos);
  1590. }
  1591. static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
  1592. int *valp,
  1593. int write, void *data)
  1594. {
  1595. if (write) {
  1596. *valp = *negp ? -*lvalp : *lvalp;
  1597. } else {
  1598. int val = *valp;
  1599. if (val < 0) {
  1600. *negp = -1;
  1601. *lvalp = (unsigned long)-val;
  1602. } else {
  1603. *negp = 0;
  1604. *lvalp = (unsigned long)val;
  1605. }
  1606. }
  1607. return 0;
  1608. }
  1609. static int __do_proc_dointvec(void *tbl_data, ctl_table *table,
  1610. int write, struct file *filp, void __user *buffer,
  1611. size_t *lenp, loff_t *ppos,
  1612. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1613. int write, void *data),
  1614. void *data)
  1615. {
  1616. #define TMPBUFLEN 21
  1617. int *i, vleft, first=1, neg, val;
  1618. unsigned long lval;
  1619. size_t left, len;
  1620. char buf[TMPBUFLEN], *p;
  1621. char __user *s = buffer;
  1622. if (!tbl_data || !table->maxlen || !*lenp ||
  1623. (*ppos && !write)) {
  1624. *lenp = 0;
  1625. return 0;
  1626. }
  1627. i = (int *) tbl_data;
  1628. vleft = table->maxlen / sizeof(*i);
  1629. left = *lenp;
  1630. if (!conv)
  1631. conv = do_proc_dointvec_conv;
  1632. for (; left && vleft--; i++, first=0) {
  1633. if (write) {
  1634. while (left) {
  1635. char c;
  1636. if (get_user(c, s))
  1637. return -EFAULT;
  1638. if (!isspace(c))
  1639. break;
  1640. left--;
  1641. s++;
  1642. }
  1643. if (!left)
  1644. break;
  1645. neg = 0;
  1646. len = left;
  1647. if (len > sizeof(buf) - 1)
  1648. len = sizeof(buf) - 1;
  1649. if (copy_from_user(buf, s, len))
  1650. return -EFAULT;
  1651. buf[len] = 0;
  1652. p = buf;
  1653. if (*p == '-' && left > 1) {
  1654. neg = 1;
  1655. p++;
  1656. }
  1657. if (*p < '0' || *p > '9')
  1658. break;
  1659. lval = simple_strtoul(p, &p, 0);
  1660. len = p-buf;
  1661. if ((len < left) && *p && !isspace(*p))
  1662. break;
  1663. if (neg)
  1664. val = -val;
  1665. s += len;
  1666. left -= len;
  1667. if (conv(&neg, &lval, i, 1, data))
  1668. break;
  1669. } else {
  1670. p = buf;
  1671. if (!first)
  1672. *p++ = '\t';
  1673. if (conv(&neg, &lval, i, 0, data))
  1674. break;
  1675. sprintf(p, "%s%lu", neg ? "-" : "", lval);
  1676. len = strlen(buf);
  1677. if (len > left)
  1678. len = left;
  1679. if(copy_to_user(s, buf, len))
  1680. return -EFAULT;
  1681. left -= len;
  1682. s += len;
  1683. }
  1684. }
  1685. if (!write && !first && left) {
  1686. if(put_user('\n', s))
  1687. return -EFAULT;
  1688. left--, s++;
  1689. }
  1690. if (write) {
  1691. while (left) {
  1692. char c;
  1693. if (get_user(c, s++))
  1694. return -EFAULT;
  1695. if (!isspace(c))
  1696. break;
  1697. left--;
  1698. }
  1699. }
  1700. if (write && first)
  1701. return -EINVAL;
  1702. *lenp -= left;
  1703. *ppos += *lenp;
  1704. return 0;
  1705. #undef TMPBUFLEN
  1706. }
  1707. static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
  1708. void __user *buffer, size_t *lenp, loff_t *ppos,
  1709. int (*conv)(int *negp, unsigned long *lvalp, int *valp,
  1710. int write, void *data),
  1711. void *data)
  1712. {
  1713. return __do_proc_dointvec(table->data, table, write, filp,
  1714. buffer, lenp, ppos, conv, data);
  1715. }
  1716. /**
  1717. * proc_dointvec - read a vector of integers
  1718. * @table: the sysctl table
  1719. * @write: %TRUE if this is a write to the sysctl file
  1720. * @filp: the file structure
  1721. * @buffer: the user buffer
  1722. * @lenp: the size of the user buffer
  1723. * @ppos: file position
  1724. *
  1725. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1726. * values from/to the user buffer, treated as an ASCII string.
  1727. *
  1728. * Returns 0 on success.
  1729. */
  1730. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  1731. void __user *buffer, size_t *lenp, loff_t *ppos)
  1732. {
  1733. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1734. NULL,NULL);
  1735. }
  1736. #define OP_SET 0
  1737. #define OP_AND 1
  1738. #define OP_OR 2
  1739. static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
  1740. int *valp,
  1741. int write, void *data)
  1742. {
  1743. int op = *(int *)data;
  1744. if (write) {
  1745. int val = *negp ? -*lvalp : *lvalp;
  1746. switch(op) {
  1747. case OP_SET: *valp = val; break;
  1748. case OP_AND: *valp &= val; break;
  1749. case OP_OR: *valp |= val; break;
  1750. }
  1751. } else {
  1752. int val = *valp;
  1753. if (val < 0) {
  1754. *negp = -1;
  1755. *lvalp = (unsigned long)-val;
  1756. } else {
  1757. *negp = 0;
  1758. *lvalp = (unsigned long)val;
  1759. }
  1760. }
  1761. return 0;
  1762. }
  1763. /*
  1764. * init may raise the set.
  1765. */
  1766. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  1767. void __user *buffer, size_t *lenp, loff_t *ppos)
  1768. {
  1769. int op;
  1770. if (write && !capable(CAP_SYS_MODULE)) {
  1771. return -EPERM;
  1772. }
  1773. op = is_init(current) ? OP_SET : OP_AND;
  1774. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1775. do_proc_dointvec_bset_conv,&op);
  1776. }
  1777. /*
  1778. * Taint values can only be increased
  1779. */
  1780. static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
  1781. void __user *buffer, size_t *lenp, loff_t *ppos)
  1782. {
  1783. int op;
  1784. if (write && !capable(CAP_SYS_ADMIN))
  1785. return -EPERM;
  1786. op = OP_OR;
  1787. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  1788. do_proc_dointvec_bset_conv,&op);
  1789. }
  1790. struct do_proc_dointvec_minmax_conv_param {
  1791. int *min;
  1792. int *max;
  1793. };
  1794. static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  1795. int *valp,
  1796. int write, void *data)
  1797. {
  1798. struct do_proc_dointvec_minmax_conv_param *param = data;
  1799. if (write) {
  1800. int val = *negp ? -*lvalp : *lvalp;
  1801. if ((param->min && *param->min > val) ||
  1802. (param->max && *param->max < val))
  1803. return -EINVAL;
  1804. *valp = val;
  1805. } else {
  1806. int val = *valp;
  1807. if (val < 0) {
  1808. *negp = -1;
  1809. *lvalp = (unsigned long)-val;
  1810. } else {
  1811. *negp = 0;
  1812. *lvalp = (unsigned long)val;
  1813. }
  1814. }
  1815. return 0;
  1816. }
  1817. /**
  1818. * proc_dointvec_minmax - read a vector of integers with min/max values
  1819. * @table: the sysctl table
  1820. * @write: %TRUE if this is a write to the sysctl file
  1821. * @filp: the file structure
  1822. * @buffer: the user buffer
  1823. * @lenp: the size of the user buffer
  1824. * @ppos: file position
  1825. *
  1826. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  1827. * values from/to the user buffer, treated as an ASCII string.
  1828. *
  1829. * This routine will ensure the values are within the range specified by
  1830. * table->extra1 (min) and table->extra2 (max).
  1831. *
  1832. * Returns 0 on success.
  1833. */
  1834. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  1835. void __user *buffer, size_t *lenp, loff_t *ppos)
  1836. {
  1837. struct do_proc_dointvec_minmax_conv_param param = {
  1838. .min = (int *) table->extra1,
  1839. .max = (int *) table->extra2,
  1840. };
  1841. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  1842. do_proc_dointvec_minmax_conv, &param);
  1843. }
  1844. static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,
  1845. struct file *filp,
  1846. void __user *buffer,
  1847. size_t *lenp, loff_t *ppos,
  1848. unsigned long convmul,
  1849. unsigned long convdiv)
  1850. {
  1851. #define TMPBUFLEN 21
  1852. unsigned long *i, *min, *max, val;
  1853. int vleft, first=1, neg;
  1854. size_t len, left;
  1855. char buf[TMPBUFLEN], *p;
  1856. char __user *s = buffer;
  1857. if (!data || !table->maxlen || !*lenp ||
  1858. (*ppos && !write)) {
  1859. *lenp = 0;
  1860. return 0;
  1861. }
  1862. i = (unsigned long *) data;
  1863. min = (unsigned long *) table->extra1;
  1864. max = (unsigned long *) table->extra2;
  1865. vleft = table->maxlen / sizeof(unsigned long);
  1866. left = *lenp;
  1867. for (; left && vleft--; i++, min++, max++, first=0) {
  1868. if (write) {
  1869. while (left) {
  1870. char c;
  1871. if (get_user(c, s))
  1872. return -EFAULT;
  1873. if (!isspace(c))
  1874. break;
  1875. left--;
  1876. s++;
  1877. }
  1878. if (!left)
  1879. break;
  1880. neg = 0;
  1881. len = left;
  1882. if (len > TMPBUFLEN-1)
  1883. len = TMPBUFLEN-1;
  1884. if (copy_from_user(buf, s, len))
  1885. return -EFAULT;
  1886. buf[len] = 0;
  1887. p = buf;
  1888. if (*p == '-' && left > 1) {
  1889. neg = 1;
  1890. p++;
  1891. }
  1892. if (*p < '0' || *p > '9')
  1893. break;
  1894. val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
  1895. len = p-buf;
  1896. if ((len < left) && *p && !isspace(*p))
  1897. break;
  1898. if (neg)
  1899. val = -val;
  1900. s += len;
  1901. left -= len;
  1902. if(neg)
  1903. continue;
  1904. if ((min && val < *min) || (max && val > *max))
  1905. continue;
  1906. *i = val;
  1907. } else {
  1908. p = buf;
  1909. if (!first)
  1910. *p++ = '\t';
  1911. sprintf(p, "%lu", convdiv * (*i) / convmul);
  1912. len = strlen(buf);
  1913. if (len > left)
  1914. len = left;
  1915. if(copy_to_user(s, buf, len))
  1916. return -EFAULT;
  1917. left -= len;
  1918. s += len;
  1919. }
  1920. }
  1921. if (!write && !first && left) {
  1922. if(put_user('\n', s))
  1923. return -EFAULT;
  1924. left--, s++;
  1925. }
  1926. if (write) {
  1927. while (left) {
  1928. char c;
  1929. if (get_user(c, s++))
  1930. return -EFAULT;
  1931. if (!isspace(c))
  1932. break;
  1933. left--;
  1934. }
  1935. }
  1936. if (write && first)
  1937. return -EINVAL;
  1938. *lenp -= left;
  1939. *ppos += *lenp;
  1940. return 0;
  1941. #undef TMPBUFLEN
  1942. }
  1943. static int do_proc_doulongvec_minmax(ctl_table *table, int write,
  1944. struct file *filp,
  1945. void __user *buffer,
  1946. size_t *lenp, loff_t *ppos,
  1947. unsigned long convmul,
  1948. unsigned long convdiv)
  1949. {
  1950. return __do_proc_doulongvec_minmax(table->data, table, write,
  1951. filp, buffer, lenp, ppos, convmul, convdiv);
  1952. }
  1953. /**
  1954. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  1955. * @table: the sysctl table
  1956. * @write: %TRUE if this is a write to the sysctl file
  1957. * @filp: the file structure
  1958. * @buffer: the user buffer
  1959. * @lenp: the size of the user buffer
  1960. * @ppos: file position
  1961. *
  1962. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1963. * values from/to the user buffer, treated as an ASCII string.
  1964. *
  1965. * This routine will ensure the values are within the range specified by
  1966. * table->extra1 (min) and table->extra2 (max).
  1967. *
  1968. * Returns 0 on success.
  1969. */
  1970. int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  1971. void __user *buffer, size_t *lenp, loff_t *ppos)
  1972. {
  1973. return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
  1974. }
  1975. /**
  1976. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  1977. * @table: the sysctl table
  1978. * @write: %TRUE if this is a write to the sysctl file
  1979. * @filp: the file structure
  1980. * @buffer: the user buffer
  1981. * @lenp: the size of the user buffer
  1982. * @ppos: file position
  1983. *
  1984. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  1985. * values from/to the user buffer, treated as an ASCII string. The values
  1986. * are treated as milliseconds, and converted to jiffies when they are stored.
  1987. *
  1988. * This routine will ensure the values are within the range specified by
  1989. * table->extra1 (min) and table->extra2 (max).
  1990. *
  1991. * Returns 0 on success.
  1992. */
  1993. int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  1994. struct file *filp,
  1995. void __user *buffer,
  1996. size_t *lenp, loff_t *ppos)
  1997. {
  1998. return do_proc_doulongvec_minmax(table, write, filp, buffer,
  1999. lenp, ppos, HZ, 1000l);
  2000. }
  2001. static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
  2002. int *valp,
  2003. int write, void *data)
  2004. {
  2005. if (write) {
  2006. if (*lvalp > LONG_MAX / HZ)
  2007. return 1;
  2008. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  2009. } else {
  2010. int val = *valp;
  2011. unsigned long lval;
  2012. if (val < 0) {
  2013. *negp = -1;
  2014. lval = (unsigned long)-val;
  2015. } else {
  2016. *negp = 0;
  2017. lval = (unsigned long)val;
  2018. }
  2019. *lvalp = lval / HZ;
  2020. }
  2021. return 0;
  2022. }
  2023. static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  2024. int *valp,
  2025. int write, void *data)
  2026. {
  2027. if (write) {
  2028. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2029. return 1;
  2030. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2031. } else {
  2032. int val = *valp;
  2033. unsigned long lval;
  2034. if (val < 0) {
  2035. *negp = -1;
  2036. lval = (unsigned long)-val;
  2037. } else {
  2038. *negp = 0;
  2039. lval = (unsigned long)val;
  2040. }
  2041. *lvalp = jiffies_to_clock_t(lval);
  2042. }
  2043. return 0;
  2044. }
  2045. static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
  2046. int *valp,
  2047. int write, void *data)
  2048. {
  2049. if (write) {
  2050. *valp = msecs_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_msecs(lval);
  2062. }
  2063. return 0;
  2064. }
  2065. /**
  2066. * proc_dointvec_jiffies - read a vector of integers as seconds
  2067. * @table: the sysctl table
  2068. * @write: %TRUE if this is a write to the sysctl file
  2069. * @filp: the file structure
  2070. * @buffer: the user buffer
  2071. * @lenp: the size of the user buffer
  2072. * @ppos: file position
  2073. *
  2074. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2075. * values from/to the user buffer, treated as an ASCII string.
  2076. * The values read are assumed to be in seconds, and are converted into
  2077. * jiffies.
  2078. *
  2079. * Returns 0 on success.
  2080. */
  2081. int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  2082. void __user *buffer, size_t *lenp, loff_t *ppos)
  2083. {
  2084. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2085. do_proc_dointvec_jiffies_conv,NULL);
  2086. }
  2087. /**
  2088. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2089. * @table: the sysctl table
  2090. * @write: %TRUE if this is a write to the sysctl file
  2091. * @filp: the file structure
  2092. * @buffer: the user buffer
  2093. * @lenp: the size of the user buffer
  2094. * @ppos: pointer to the file position
  2095. *
  2096. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2097. * values from/to the user buffer, treated as an ASCII string.
  2098. * The values read are assumed to be in 1/USER_HZ seconds, and
  2099. * are converted into jiffies.
  2100. *
  2101. * Returns 0 on success.
  2102. */
  2103. int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
  2104. void __user *buffer, size_t *lenp, loff_t *ppos)
  2105. {
  2106. return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
  2107. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2108. }
  2109. /**
  2110. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2111. * @table: the sysctl table
  2112. * @write: %TRUE if this is a write to the sysctl file
  2113. * @filp: the file structure
  2114. * @buffer: the user buffer
  2115. * @lenp: the size of the user buffer
  2116. * @ppos: file position
  2117. * @ppos: the current position in the file
  2118. *
  2119. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2120. * values from/to the user buffer, treated as an ASCII string.
  2121. * The values read are assumed to be in 1/1000 seconds, and
  2122. * are converted into jiffies.
  2123. *
  2124. * Returns 0 on success.
  2125. */
  2126. int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
  2127. void __user *buffer, size_t *lenp, loff_t *ppos)
  2128. {
  2129. return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
  2130. do_proc_dointvec_ms_jiffies_conv, NULL);
  2131. }
  2132. static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
  2133. void __user *buffer, size_t *lenp, loff_t *ppos)
  2134. {
  2135. struct pid *new_pid;
  2136. pid_t tmp;
  2137. int r;
  2138. tmp = pid_nr(cad_pid);
  2139. r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
  2140. lenp, ppos, NULL, NULL);
  2141. if (r || !write)
  2142. return r;
  2143. new_pid = find_get_pid(tmp);
  2144. if (!new_pid)
  2145. return -ESRCH;
  2146. put_pid(xchg(&cad_pid, new_pid));
  2147. return 0;
  2148. }
  2149. #else /* CONFIG_PROC_FS */
  2150. int proc_dostring(ctl_table *table, int write, struct file *filp,
  2151. void __user *buffer, size_t *lenp, loff_t *ppos)
  2152. {
  2153. return -ENOSYS;
  2154. }
  2155. int proc_dointvec(ctl_table *table, int write, struct file *filp,
  2156. void __user *buffer, size_t *lenp, loff_t *ppos)
  2157. {
  2158. return -ENOSYS;
  2159. }
  2160. int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
  2161. void __user *buffer, size_t *lenp, loff_t *ppos)
  2162. {
  2163. return -ENOSYS;
  2164. }
  2165. int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
  2166. void __user *buffer, size_t *lenp, loff_t *ppos)
  2167. {
  2168. return -ENOSYS;
  2169. }
  2170. int proc_dointvec_jiffies(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_userhz_jiffies(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_ms_jiffies(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_doulongvec_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_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
  2191. struct file *filp,
  2192. void __user *buffer,
  2193. size_t *lenp, loff_t *ppos)
  2194. {
  2195. return -ENOSYS;
  2196. }
  2197. #endif /* CONFIG_PROC_FS */
  2198. #ifdef CONFIG_SYSCTL_SYSCALL
  2199. /*
  2200. * General sysctl support routines
  2201. */
  2202. /* The generic string strategy routine: */
  2203. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2204. void __user *oldval, size_t __user *oldlenp,
  2205. void __user *newval, size_t newlen)
  2206. {
  2207. if (!table->data || !table->maxlen)
  2208. return -ENOTDIR;
  2209. if (oldval && oldlenp) {
  2210. size_t bufsize;
  2211. if (get_user(bufsize, oldlenp))
  2212. return -EFAULT;
  2213. if (bufsize) {
  2214. size_t len = strlen(table->data), copied;
  2215. /* This shouldn't trigger for a well-formed sysctl */
  2216. if (len > table->maxlen)
  2217. len = table->maxlen;
  2218. /* Copy up to a max of bufsize-1 bytes of the string */
  2219. copied = (len >= bufsize) ? bufsize - 1 : len;
  2220. if (copy_to_user(oldval, table->data, copied) ||
  2221. put_user(0, (char __user *)(oldval + copied)))
  2222. return -EFAULT;
  2223. if (put_user(len, oldlenp))
  2224. return -EFAULT;
  2225. }
  2226. }
  2227. if (newval && newlen) {
  2228. size_t len = newlen;
  2229. if (len > table->maxlen)
  2230. len = table->maxlen;
  2231. if(copy_from_user(table->data, newval, len))
  2232. return -EFAULT;
  2233. if (len == table->maxlen)
  2234. len--;
  2235. ((char *) table->data)[len] = 0;
  2236. }
  2237. return 1;
  2238. }
  2239. /*
  2240. * This function makes sure that all of the integers in the vector
  2241. * are between the minimum and maximum values given in the arrays
  2242. * table->extra1 and table->extra2, respectively.
  2243. */
  2244. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2245. void __user *oldval, size_t __user *oldlenp,
  2246. void __user *newval, size_t newlen)
  2247. {
  2248. if (newval && newlen) {
  2249. int __user *vec = (int __user *) newval;
  2250. int *min = (int *) table->extra1;
  2251. int *max = (int *) table->extra2;
  2252. size_t length;
  2253. int i;
  2254. if (newlen % sizeof(int) != 0)
  2255. return -EINVAL;
  2256. if (!table->extra1 && !table->extra2)
  2257. return 0;
  2258. if (newlen > table->maxlen)
  2259. newlen = table->maxlen;
  2260. length = newlen / sizeof(int);
  2261. for (i = 0; i < length; i++) {
  2262. int value;
  2263. if (get_user(value, vec + i))
  2264. return -EFAULT;
  2265. if (min && value < min[i])
  2266. return -EINVAL;
  2267. if (max && value > max[i])
  2268. return -EINVAL;
  2269. }
  2270. }
  2271. return 0;
  2272. }
  2273. /* Strategy function to convert jiffies to seconds */
  2274. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2275. void __user *oldval, size_t __user *oldlenp,
  2276. void __user *newval, size_t newlen)
  2277. {
  2278. if (oldval && oldlenp) {
  2279. size_t olen;
  2280. if (get_user(olen, oldlenp))
  2281. return -EFAULT;
  2282. if (olen) {
  2283. int val;
  2284. if (olen < sizeof(int))
  2285. return -EINVAL;
  2286. val = *(int *)(table->data) / HZ;
  2287. if (put_user(val, (int __user *)oldval))
  2288. return -EFAULT;
  2289. if (put_user(sizeof(int), oldlenp))
  2290. return -EFAULT;
  2291. }
  2292. }
  2293. if (newval && newlen) {
  2294. int new;
  2295. if (newlen != sizeof(int))
  2296. return -EINVAL;
  2297. if (get_user(new, (int __user *)newval))
  2298. return -EFAULT;
  2299. *(int *)(table->data) = new*HZ;
  2300. }
  2301. return 1;
  2302. }
  2303. /* Strategy function to convert jiffies to seconds */
  2304. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2305. void __user *oldval, size_t __user *oldlenp,
  2306. void __user *newval, size_t newlen)
  2307. {
  2308. if (oldval && oldlenp) {
  2309. size_t olen;
  2310. if (get_user(olen, oldlenp))
  2311. return -EFAULT;
  2312. if (olen) {
  2313. int val;
  2314. if (olen < sizeof(int))
  2315. return -EINVAL;
  2316. val = jiffies_to_msecs(*(int *)(table->data));
  2317. if (put_user(val, (int __user *)oldval))
  2318. return -EFAULT;
  2319. if (put_user(sizeof(int), oldlenp))
  2320. return -EFAULT;
  2321. }
  2322. }
  2323. if (newval && newlen) {
  2324. int new;
  2325. if (newlen != sizeof(int))
  2326. return -EINVAL;
  2327. if (get_user(new, (int __user *)newval))
  2328. return -EFAULT;
  2329. *(int *)(table->data) = msecs_to_jiffies(new);
  2330. }
  2331. return 1;
  2332. }
  2333. #else /* CONFIG_SYSCTL_SYSCALL */
  2334. asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
  2335. {
  2336. static int msg_count;
  2337. struct __sysctl_args tmp;
  2338. int name[CTL_MAXNAME];
  2339. int i;
  2340. /* Read in the sysctl name for better debug message logging */
  2341. if (copy_from_user(&tmp, args, sizeof(tmp)))
  2342. return -EFAULT;
  2343. if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
  2344. return -ENOTDIR;
  2345. for (i = 0; i < tmp.nlen; i++)
  2346. if (get_user(name[i], tmp.name + i))
  2347. return -EFAULT;
  2348. /* Ignore accesses to kernel.version */
  2349. if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
  2350. goto out;
  2351. if (msg_count < 5) {
  2352. msg_count++;
  2353. printk(KERN_INFO
  2354. "warning: process `%s' used the removed sysctl "
  2355. "system call with ", current->comm);
  2356. for (i = 0; i < tmp.nlen; i++)
  2357. printk("%d.", name[i]);
  2358. printk("\n");
  2359. }
  2360. out:
  2361. return -ENOSYS;
  2362. }
  2363. int sysctl_string(ctl_table *table, int __user *name, int nlen,
  2364. void __user *oldval, size_t __user *oldlenp,
  2365. void __user *newval, size_t newlen)
  2366. {
  2367. return -ENOSYS;
  2368. }
  2369. int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
  2370. void __user *oldval, size_t __user *oldlenp,
  2371. void __user *newval, size_t newlen)
  2372. {
  2373. return -ENOSYS;
  2374. }
  2375. int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
  2376. void __user *oldval, size_t __user *oldlenp,
  2377. void __user *newval, size_t newlen)
  2378. {
  2379. return -ENOSYS;
  2380. }
  2381. int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
  2382. void __user *oldval, size_t __user *oldlenp,
  2383. void __user *newval, size_t newlen)
  2384. {
  2385. return -ENOSYS;
  2386. }
  2387. #endif /* CONFIG_SYSCTL_SYSCALL */
  2388. /*
  2389. * No sense putting this after each symbol definition, twice,
  2390. * exception granted :-)
  2391. */
  2392. EXPORT_SYMBOL(proc_dointvec);
  2393. EXPORT_SYMBOL(proc_dointvec_jiffies);
  2394. EXPORT_SYMBOL(proc_dointvec_minmax);
  2395. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  2396. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  2397. EXPORT_SYMBOL(proc_dostring);
  2398. EXPORT_SYMBOL(proc_doulongvec_minmax);
  2399. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
  2400. EXPORT_SYMBOL(register_sysctl_table);
  2401. EXPORT_SYMBOL(sysctl_intvec);
  2402. EXPORT_SYMBOL(sysctl_jiffies);
  2403. EXPORT_SYMBOL(sysctl_ms_jiffies);
  2404. EXPORT_SYMBOL(sysctl_string);
  2405. EXPORT_SYMBOL(unregister_sysctl_table);