sysctl.c 60 KB

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