sysctl.c 60 KB

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