sysctl.c 60 KB

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