sysctl.c 59 KB

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