sysctl.c 60 KB

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