sysctl.c 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224
  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/aio.h>
  22. #include <linux/mm.h>
  23. #include <linux/swap.h>
  24. #include <linux/slab.h>
  25. #include <linux/sysctl.h>
  26. #include <linux/bitmap.h>
  27. #include <linux/signal.h>
  28. #include <linux/printk.h>
  29. #include <linux/proc_fs.h>
  30. #include <linux/security.h>
  31. #include <linux/ctype.h>
  32. #include <linux/kmemleak.h>
  33. #include <linux/fs.h>
  34. #include <linux/init.h>
  35. #include <linux/kernel.h>
  36. #include <linux/kobject.h>
  37. #include <linux/net.h>
  38. #include <linux/sysrq.h>
  39. #include <linux/highuid.h>
  40. #include <linux/writeback.h>
  41. #include <linux/ratelimit.h>
  42. #include <linux/compaction.h>
  43. #include <linux/hugetlb.h>
  44. #include <linux/initrd.h>
  45. #include <linux/key.h>
  46. #include <linux/times.h>
  47. #include <linux/limits.h>
  48. #include <linux/dcache.h>
  49. #include <linux/dnotify.h>
  50. #include <linux/syscalls.h>
  51. #include <linux/vmstat.h>
  52. #include <linux/nfs_fs.h>
  53. #include <linux/acpi.h>
  54. #include <linux/reboot.h>
  55. #include <linux/ftrace.h>
  56. #include <linux/perf_event.h>
  57. #include <linux/kprobes.h>
  58. #include <linux/pipe_fs_i.h>
  59. #include <linux/oom.h>
  60. #include <linux/kmod.h>
  61. #include <linux/capability.h>
  62. #include <linux/binfmts.h>
  63. #include <linux/sched/sysctl.h>
  64. #include <linux/sched/coredump.h>
  65. #include <linux/kexec.h>
  66. #include <linux/bpf.h>
  67. #include <linux/mount.h>
  68. #include <linux/pipe_fs_i.h>
  69. #include <linux/uaccess.h>
  70. #include <asm/processor.h>
  71. #ifdef CONFIG_X86
  72. #include <asm/nmi.h>
  73. #include <asm/stacktrace.h>
  74. #include <asm/io.h>
  75. #endif
  76. #ifdef CONFIG_SPARC
  77. #include <asm/setup.h>
  78. #endif
  79. #ifdef CONFIG_BSD_PROCESS_ACCT
  80. #include <linux/acct.h>
  81. #endif
  82. #ifdef CONFIG_RT_MUTEXES
  83. #include <linux/rtmutex.h>
  84. #endif
  85. #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
  86. #include <linux/lockdep.h>
  87. #endif
  88. #ifdef CONFIG_CHR_DEV_SG
  89. #include <scsi/sg.h>
  90. #endif
  91. #ifdef CONFIG_LOCKUP_DETECTOR
  92. #include <linux/nmi.h>
  93. #endif
  94. #if defined(CONFIG_SYSCTL)
  95. /* External variables not in a header file. */
  96. extern int suid_dumpable;
  97. #ifdef CONFIG_COREDUMP
  98. extern int core_uses_pid;
  99. extern char core_pattern[];
  100. extern unsigned int core_pipe_limit;
  101. #endif
  102. extern int pid_max;
  103. extern int pid_max_min, pid_max_max;
  104. extern int percpu_pagelist_fraction;
  105. extern int latencytop_enabled;
  106. extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
  107. #ifndef CONFIG_MMU
  108. extern int sysctl_nr_trim_pages;
  109. #endif
  110. /* Constants used for minimum and maximum */
  111. #ifdef CONFIG_LOCKUP_DETECTOR
  112. static int sixty = 60;
  113. #endif
  114. static int __maybe_unused neg_one = -1;
  115. static int zero;
  116. static int __maybe_unused one = 1;
  117. static int __maybe_unused two = 2;
  118. static int __maybe_unused four = 4;
  119. static unsigned long one_ul = 1;
  120. static int one_hundred = 100;
  121. static int one_thousand = 1000;
  122. #ifdef CONFIG_PRINTK
  123. static int ten_thousand = 10000;
  124. #endif
  125. #ifdef CONFIG_PERF_EVENTS
  126. static int six_hundred_forty_kb = 640 * 1024;
  127. #endif
  128. /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
  129. static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
  130. /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  131. static int maxolduid = 65535;
  132. static int minolduid;
  133. static int ngroups_max = NGROUPS_MAX;
  134. static const int cap_last_cap = CAP_LAST_CAP;
  135. /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
  136. #ifdef CONFIG_DETECT_HUNG_TASK
  137. static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
  138. #endif
  139. #ifdef CONFIG_INOTIFY_USER
  140. #include <linux/inotify.h>
  141. #endif
  142. #ifdef CONFIG_SPARC
  143. #endif
  144. #ifdef __hppa__
  145. extern int pwrsw_enabled;
  146. #endif
  147. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  148. extern int unaligned_enabled;
  149. #endif
  150. #ifdef CONFIG_IA64
  151. extern int unaligned_dump_stack;
  152. #endif
  153. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  154. extern int no_unaligned_warning;
  155. #endif
  156. #ifdef CONFIG_PROC_SYSCTL
  157. /**
  158. * enum sysctl_writes_mode - supported sysctl write modes
  159. *
  160. * @SYSCTL_WRITES_LEGACY: each write syscall must fully contain the sysctl value
  161. * to be written, and multiple writes on the same sysctl file descriptor
  162. * will rewrite the sysctl value, regardless of file position. No warning
  163. * is issued when the initial position is not 0.
  164. * @SYSCTL_WRITES_WARN: same as above but warn when the initial file position is
  165. * not 0.
  166. * @SYSCTL_WRITES_STRICT: writes to numeric sysctl entries must always be at
  167. * file position 0 and the value must be fully contained in the buffer
  168. * sent to the write syscall. If dealing with strings respect the file
  169. * position, but restrict this to the max length of the buffer, anything
  170. * passed the max lenght will be ignored. Multiple writes will append
  171. * to the buffer.
  172. *
  173. * These write modes control how current file position affects the behavior of
  174. * updating sysctl values through the proc interface on each write.
  175. */
  176. enum sysctl_writes_mode {
  177. SYSCTL_WRITES_LEGACY = -1,
  178. SYSCTL_WRITES_WARN = 0,
  179. SYSCTL_WRITES_STRICT = 1,
  180. };
  181. static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
  182. static int proc_do_cad_pid(struct ctl_table *table, int write,
  183. void __user *buffer, size_t *lenp, loff_t *ppos);
  184. static int proc_taint(struct ctl_table *table, int write,
  185. void __user *buffer, size_t *lenp, loff_t *ppos);
  186. #endif
  187. #ifdef CONFIG_PRINTK
  188. static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
  189. void __user *buffer, size_t *lenp, loff_t *ppos);
  190. #endif
  191. static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  192. void __user *buffer, size_t *lenp, loff_t *ppos);
  193. #ifdef CONFIG_COREDUMP
  194. static int proc_dostring_coredump(struct ctl_table *table, int write,
  195. void __user *buffer, size_t *lenp, loff_t *ppos);
  196. #endif
  197. #ifdef CONFIG_MAGIC_SYSRQ
  198. /* Note: sysrq code uses it's own private copy */
  199. static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
  200. static int sysrq_sysctl_handler(struct ctl_table *table, int write,
  201. void __user *buffer, size_t *lenp,
  202. loff_t *ppos)
  203. {
  204. int error;
  205. error = proc_dointvec(table, write, buffer, lenp, ppos);
  206. if (error)
  207. return error;
  208. if (write)
  209. sysrq_toggle_support(__sysrq_enabled);
  210. return 0;
  211. }
  212. #endif
  213. static struct ctl_table kern_table[];
  214. static struct ctl_table vm_table[];
  215. static struct ctl_table fs_table[];
  216. static struct ctl_table debug_table[];
  217. static struct ctl_table dev_table[];
  218. extern struct ctl_table random_table[];
  219. #ifdef CONFIG_EPOLL
  220. extern struct ctl_table epoll_table[];
  221. #endif
  222. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  223. int sysctl_legacy_va_layout;
  224. #endif
  225. /* The default sysctl tables: */
  226. static struct ctl_table sysctl_base_table[] = {
  227. {
  228. .procname = "kernel",
  229. .mode = 0555,
  230. .child = kern_table,
  231. },
  232. {
  233. .procname = "vm",
  234. .mode = 0555,
  235. .child = vm_table,
  236. },
  237. {
  238. .procname = "fs",
  239. .mode = 0555,
  240. .child = fs_table,
  241. },
  242. {
  243. .procname = "debug",
  244. .mode = 0555,
  245. .child = debug_table,
  246. },
  247. {
  248. .procname = "dev",
  249. .mode = 0555,
  250. .child = dev_table,
  251. },
  252. { }
  253. };
  254. #ifdef CONFIG_SCHED_DEBUG
  255. static int min_sched_granularity_ns = 100000; /* 100 usecs */
  256. static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
  257. static int min_wakeup_granularity_ns; /* 0 usecs */
  258. static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
  259. #ifdef CONFIG_SMP
  260. static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
  261. static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
  262. #endif /* CONFIG_SMP */
  263. #endif /* CONFIG_SCHED_DEBUG */
  264. #ifdef CONFIG_COMPACTION
  265. static int min_extfrag_threshold;
  266. static int max_extfrag_threshold = 1000;
  267. #endif
  268. static struct ctl_table kern_table[] = {
  269. {
  270. .procname = "sched_child_runs_first",
  271. .data = &sysctl_sched_child_runs_first,
  272. .maxlen = sizeof(unsigned int),
  273. .mode = 0644,
  274. .proc_handler = proc_dointvec,
  275. },
  276. #ifdef CONFIG_SCHED_DEBUG
  277. {
  278. .procname = "sched_min_granularity_ns",
  279. .data = &sysctl_sched_min_granularity,
  280. .maxlen = sizeof(unsigned int),
  281. .mode = 0644,
  282. .proc_handler = sched_proc_update_handler,
  283. .extra1 = &min_sched_granularity_ns,
  284. .extra2 = &max_sched_granularity_ns,
  285. },
  286. {
  287. .procname = "sched_latency_ns",
  288. .data = &sysctl_sched_latency,
  289. .maxlen = sizeof(unsigned int),
  290. .mode = 0644,
  291. .proc_handler = sched_proc_update_handler,
  292. .extra1 = &min_sched_granularity_ns,
  293. .extra2 = &max_sched_granularity_ns,
  294. },
  295. {
  296. .procname = "sched_wakeup_granularity_ns",
  297. .data = &sysctl_sched_wakeup_granularity,
  298. .maxlen = sizeof(unsigned int),
  299. .mode = 0644,
  300. .proc_handler = sched_proc_update_handler,
  301. .extra1 = &min_wakeup_granularity_ns,
  302. .extra2 = &max_wakeup_granularity_ns,
  303. },
  304. #ifdef CONFIG_SMP
  305. {
  306. .procname = "sched_tunable_scaling",
  307. .data = &sysctl_sched_tunable_scaling,
  308. .maxlen = sizeof(enum sched_tunable_scaling),
  309. .mode = 0644,
  310. .proc_handler = sched_proc_update_handler,
  311. .extra1 = &min_sched_tunable_scaling,
  312. .extra2 = &max_sched_tunable_scaling,
  313. },
  314. {
  315. .procname = "sched_migration_cost_ns",
  316. .data = &sysctl_sched_migration_cost,
  317. .maxlen = sizeof(unsigned int),
  318. .mode = 0644,
  319. .proc_handler = proc_dointvec,
  320. },
  321. {
  322. .procname = "sched_nr_migrate",
  323. .data = &sysctl_sched_nr_migrate,
  324. .maxlen = sizeof(unsigned int),
  325. .mode = 0644,
  326. .proc_handler = proc_dointvec,
  327. },
  328. {
  329. .procname = "sched_time_avg_ms",
  330. .data = &sysctl_sched_time_avg,
  331. .maxlen = sizeof(unsigned int),
  332. .mode = 0644,
  333. .proc_handler = proc_dointvec_minmax,
  334. .extra1 = &one,
  335. },
  336. #ifdef CONFIG_SCHEDSTATS
  337. {
  338. .procname = "sched_schedstats",
  339. .data = NULL,
  340. .maxlen = sizeof(unsigned int),
  341. .mode = 0644,
  342. .proc_handler = sysctl_schedstats,
  343. .extra1 = &zero,
  344. .extra2 = &one,
  345. },
  346. #endif /* CONFIG_SCHEDSTATS */
  347. #endif /* CONFIG_SMP */
  348. #ifdef CONFIG_NUMA_BALANCING
  349. {
  350. .procname = "numa_balancing_scan_delay_ms",
  351. .data = &sysctl_numa_balancing_scan_delay,
  352. .maxlen = sizeof(unsigned int),
  353. .mode = 0644,
  354. .proc_handler = proc_dointvec,
  355. },
  356. {
  357. .procname = "numa_balancing_scan_period_min_ms",
  358. .data = &sysctl_numa_balancing_scan_period_min,
  359. .maxlen = sizeof(unsigned int),
  360. .mode = 0644,
  361. .proc_handler = proc_dointvec,
  362. },
  363. {
  364. .procname = "numa_balancing_scan_period_max_ms",
  365. .data = &sysctl_numa_balancing_scan_period_max,
  366. .maxlen = sizeof(unsigned int),
  367. .mode = 0644,
  368. .proc_handler = proc_dointvec,
  369. },
  370. {
  371. .procname = "numa_balancing_scan_size_mb",
  372. .data = &sysctl_numa_balancing_scan_size,
  373. .maxlen = sizeof(unsigned int),
  374. .mode = 0644,
  375. .proc_handler = proc_dointvec_minmax,
  376. .extra1 = &one,
  377. },
  378. {
  379. .procname = "numa_balancing",
  380. .data = NULL, /* filled in by handler */
  381. .maxlen = sizeof(unsigned int),
  382. .mode = 0644,
  383. .proc_handler = sysctl_numa_balancing,
  384. .extra1 = &zero,
  385. .extra2 = &one,
  386. },
  387. #endif /* CONFIG_NUMA_BALANCING */
  388. #endif /* CONFIG_SCHED_DEBUG */
  389. {
  390. .procname = "sched_rt_period_us",
  391. .data = &sysctl_sched_rt_period,
  392. .maxlen = sizeof(unsigned int),
  393. .mode = 0644,
  394. .proc_handler = sched_rt_handler,
  395. },
  396. {
  397. .procname = "sched_rt_runtime_us",
  398. .data = &sysctl_sched_rt_runtime,
  399. .maxlen = sizeof(int),
  400. .mode = 0644,
  401. .proc_handler = sched_rt_handler,
  402. },
  403. {
  404. .procname = "sched_rr_timeslice_ms",
  405. .data = &sysctl_sched_rr_timeslice,
  406. .maxlen = sizeof(int),
  407. .mode = 0644,
  408. .proc_handler = sched_rr_handler,
  409. },
  410. #ifdef CONFIG_SCHED_AUTOGROUP
  411. {
  412. .procname = "sched_autogroup_enabled",
  413. .data = &sysctl_sched_autogroup_enabled,
  414. .maxlen = sizeof(unsigned int),
  415. .mode = 0644,
  416. .proc_handler = proc_dointvec_minmax,
  417. .extra1 = &zero,
  418. .extra2 = &one,
  419. },
  420. #endif
  421. #ifdef CONFIG_CFS_BANDWIDTH
  422. {
  423. .procname = "sched_cfs_bandwidth_slice_us",
  424. .data = &sysctl_sched_cfs_bandwidth_slice,
  425. .maxlen = sizeof(unsigned int),
  426. .mode = 0644,
  427. .proc_handler = proc_dointvec_minmax,
  428. .extra1 = &one,
  429. },
  430. #endif
  431. #ifdef CONFIG_PROVE_LOCKING
  432. {
  433. .procname = "prove_locking",
  434. .data = &prove_locking,
  435. .maxlen = sizeof(int),
  436. .mode = 0644,
  437. .proc_handler = proc_dointvec,
  438. },
  439. #endif
  440. #ifdef CONFIG_LOCK_STAT
  441. {
  442. .procname = "lock_stat",
  443. .data = &lock_stat,
  444. .maxlen = sizeof(int),
  445. .mode = 0644,
  446. .proc_handler = proc_dointvec,
  447. },
  448. #endif
  449. {
  450. .procname = "panic",
  451. .data = &panic_timeout,
  452. .maxlen = sizeof(int),
  453. .mode = 0644,
  454. .proc_handler = proc_dointvec,
  455. },
  456. #ifdef CONFIG_COREDUMP
  457. {
  458. .procname = "core_uses_pid",
  459. .data = &core_uses_pid,
  460. .maxlen = sizeof(int),
  461. .mode = 0644,
  462. .proc_handler = proc_dointvec,
  463. },
  464. {
  465. .procname = "core_pattern",
  466. .data = core_pattern,
  467. .maxlen = CORENAME_MAX_SIZE,
  468. .mode = 0644,
  469. .proc_handler = proc_dostring_coredump,
  470. },
  471. {
  472. .procname = "core_pipe_limit",
  473. .data = &core_pipe_limit,
  474. .maxlen = sizeof(unsigned int),
  475. .mode = 0644,
  476. .proc_handler = proc_dointvec,
  477. },
  478. #endif
  479. #ifdef CONFIG_PROC_SYSCTL
  480. {
  481. .procname = "tainted",
  482. .maxlen = sizeof(long),
  483. .mode = 0644,
  484. .proc_handler = proc_taint,
  485. },
  486. {
  487. .procname = "sysctl_writes_strict",
  488. .data = &sysctl_writes_strict,
  489. .maxlen = sizeof(int),
  490. .mode = 0644,
  491. .proc_handler = proc_dointvec_minmax,
  492. .extra1 = &neg_one,
  493. .extra2 = &one,
  494. },
  495. #endif
  496. #ifdef CONFIG_LATENCYTOP
  497. {
  498. .procname = "latencytop",
  499. .data = &latencytop_enabled,
  500. .maxlen = sizeof(int),
  501. .mode = 0644,
  502. .proc_handler = sysctl_latencytop,
  503. },
  504. #endif
  505. #ifdef CONFIG_BLK_DEV_INITRD
  506. {
  507. .procname = "real-root-dev",
  508. .data = &real_root_dev,
  509. .maxlen = sizeof(int),
  510. .mode = 0644,
  511. .proc_handler = proc_dointvec,
  512. },
  513. #endif
  514. {
  515. .procname = "print-fatal-signals",
  516. .data = &print_fatal_signals,
  517. .maxlen = sizeof(int),
  518. .mode = 0644,
  519. .proc_handler = proc_dointvec,
  520. },
  521. #ifdef CONFIG_SPARC
  522. {
  523. .procname = "reboot-cmd",
  524. .data = reboot_command,
  525. .maxlen = 256,
  526. .mode = 0644,
  527. .proc_handler = proc_dostring,
  528. },
  529. {
  530. .procname = "stop-a",
  531. .data = &stop_a_enabled,
  532. .maxlen = sizeof (int),
  533. .mode = 0644,
  534. .proc_handler = proc_dointvec,
  535. },
  536. {
  537. .procname = "scons-poweroff",
  538. .data = &scons_pwroff,
  539. .maxlen = sizeof (int),
  540. .mode = 0644,
  541. .proc_handler = proc_dointvec,
  542. },
  543. #endif
  544. #ifdef CONFIG_SPARC64
  545. {
  546. .procname = "tsb-ratio",
  547. .data = &sysctl_tsb_ratio,
  548. .maxlen = sizeof (int),
  549. .mode = 0644,
  550. .proc_handler = proc_dointvec,
  551. },
  552. #endif
  553. #ifdef __hppa__
  554. {
  555. .procname = "soft-power",
  556. .data = &pwrsw_enabled,
  557. .maxlen = sizeof (int),
  558. .mode = 0644,
  559. .proc_handler = proc_dointvec,
  560. },
  561. #endif
  562. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  563. {
  564. .procname = "unaligned-trap",
  565. .data = &unaligned_enabled,
  566. .maxlen = sizeof (int),
  567. .mode = 0644,
  568. .proc_handler = proc_dointvec,
  569. },
  570. #endif
  571. {
  572. .procname = "ctrl-alt-del",
  573. .data = &C_A_D,
  574. .maxlen = sizeof(int),
  575. .mode = 0644,
  576. .proc_handler = proc_dointvec,
  577. },
  578. #ifdef CONFIG_FUNCTION_TRACER
  579. {
  580. .procname = "ftrace_enabled",
  581. .data = &ftrace_enabled,
  582. .maxlen = sizeof(int),
  583. .mode = 0644,
  584. .proc_handler = ftrace_enable_sysctl,
  585. },
  586. #endif
  587. #ifdef CONFIG_STACK_TRACER
  588. {
  589. .procname = "stack_tracer_enabled",
  590. .data = &stack_tracer_enabled,
  591. .maxlen = sizeof(int),
  592. .mode = 0644,
  593. .proc_handler = stack_trace_sysctl,
  594. },
  595. #endif
  596. #ifdef CONFIG_TRACING
  597. {
  598. .procname = "ftrace_dump_on_oops",
  599. .data = &ftrace_dump_on_oops,
  600. .maxlen = sizeof(int),
  601. .mode = 0644,
  602. .proc_handler = proc_dointvec,
  603. },
  604. {
  605. .procname = "traceoff_on_warning",
  606. .data = &__disable_trace_on_warning,
  607. .maxlen = sizeof(__disable_trace_on_warning),
  608. .mode = 0644,
  609. .proc_handler = proc_dointvec,
  610. },
  611. {
  612. .procname = "tracepoint_printk",
  613. .data = &tracepoint_printk,
  614. .maxlen = sizeof(tracepoint_printk),
  615. .mode = 0644,
  616. .proc_handler = tracepoint_printk_sysctl,
  617. },
  618. #endif
  619. #ifdef CONFIG_KEXEC_CORE
  620. {
  621. .procname = "kexec_load_disabled",
  622. .data = &kexec_load_disabled,
  623. .maxlen = sizeof(int),
  624. .mode = 0644,
  625. /* only handle a transition from default "0" to "1" */
  626. .proc_handler = proc_dointvec_minmax,
  627. .extra1 = &one,
  628. .extra2 = &one,
  629. },
  630. #endif
  631. #ifdef CONFIG_MODULES
  632. {
  633. .procname = "modprobe",
  634. .data = &modprobe_path,
  635. .maxlen = KMOD_PATH_LEN,
  636. .mode = 0644,
  637. .proc_handler = proc_dostring,
  638. },
  639. {
  640. .procname = "modules_disabled",
  641. .data = &modules_disabled,
  642. .maxlen = sizeof(int),
  643. .mode = 0644,
  644. /* only handle a transition from default "0" to "1" */
  645. .proc_handler = proc_dointvec_minmax,
  646. .extra1 = &one,
  647. .extra2 = &one,
  648. },
  649. #endif
  650. #ifdef CONFIG_UEVENT_HELPER
  651. {
  652. .procname = "hotplug",
  653. .data = &uevent_helper,
  654. .maxlen = UEVENT_HELPER_PATH_LEN,
  655. .mode = 0644,
  656. .proc_handler = proc_dostring,
  657. },
  658. #endif
  659. #ifdef CONFIG_CHR_DEV_SG
  660. {
  661. .procname = "sg-big-buff",
  662. .data = &sg_big_buff,
  663. .maxlen = sizeof (int),
  664. .mode = 0444,
  665. .proc_handler = proc_dointvec,
  666. },
  667. #endif
  668. #ifdef CONFIG_BSD_PROCESS_ACCT
  669. {
  670. .procname = "acct",
  671. .data = &acct_parm,
  672. .maxlen = 3*sizeof(int),
  673. .mode = 0644,
  674. .proc_handler = proc_dointvec,
  675. },
  676. #endif
  677. #ifdef CONFIG_MAGIC_SYSRQ
  678. {
  679. .procname = "sysrq",
  680. .data = &__sysrq_enabled,
  681. .maxlen = sizeof (int),
  682. .mode = 0644,
  683. .proc_handler = sysrq_sysctl_handler,
  684. },
  685. #endif
  686. #ifdef CONFIG_PROC_SYSCTL
  687. {
  688. .procname = "cad_pid",
  689. .data = NULL,
  690. .maxlen = sizeof (int),
  691. .mode = 0600,
  692. .proc_handler = proc_do_cad_pid,
  693. },
  694. #endif
  695. {
  696. .procname = "threads-max",
  697. .data = NULL,
  698. .maxlen = sizeof(int),
  699. .mode = 0644,
  700. .proc_handler = sysctl_max_threads,
  701. },
  702. {
  703. .procname = "random",
  704. .mode = 0555,
  705. .child = random_table,
  706. },
  707. {
  708. .procname = "usermodehelper",
  709. .mode = 0555,
  710. .child = usermodehelper_table,
  711. },
  712. {
  713. .procname = "overflowuid",
  714. .data = &overflowuid,
  715. .maxlen = sizeof(int),
  716. .mode = 0644,
  717. .proc_handler = proc_dointvec_minmax,
  718. .extra1 = &minolduid,
  719. .extra2 = &maxolduid,
  720. },
  721. {
  722. .procname = "overflowgid",
  723. .data = &overflowgid,
  724. .maxlen = sizeof(int),
  725. .mode = 0644,
  726. .proc_handler = proc_dointvec_minmax,
  727. .extra1 = &minolduid,
  728. .extra2 = &maxolduid,
  729. },
  730. #ifdef CONFIG_S390
  731. #ifdef CONFIG_MATHEMU
  732. {
  733. .procname = "ieee_emulation_warnings",
  734. .data = &sysctl_ieee_emulation_warnings,
  735. .maxlen = sizeof(int),
  736. .mode = 0644,
  737. .proc_handler = proc_dointvec,
  738. },
  739. #endif
  740. {
  741. .procname = "userprocess_debug",
  742. .data = &show_unhandled_signals,
  743. .maxlen = sizeof(int),
  744. .mode = 0644,
  745. .proc_handler = proc_dointvec,
  746. },
  747. #endif
  748. {
  749. .procname = "pid_max",
  750. .data = &pid_max,
  751. .maxlen = sizeof (int),
  752. .mode = 0644,
  753. .proc_handler = proc_dointvec_minmax,
  754. .extra1 = &pid_max_min,
  755. .extra2 = &pid_max_max,
  756. },
  757. {
  758. .procname = "panic_on_oops",
  759. .data = &panic_on_oops,
  760. .maxlen = sizeof(int),
  761. .mode = 0644,
  762. .proc_handler = proc_dointvec,
  763. },
  764. #if defined CONFIG_PRINTK
  765. {
  766. .procname = "printk",
  767. .data = &console_loglevel,
  768. .maxlen = 4*sizeof(int),
  769. .mode = 0644,
  770. .proc_handler = proc_dointvec,
  771. },
  772. {
  773. .procname = "printk_ratelimit",
  774. .data = &printk_ratelimit_state.interval,
  775. .maxlen = sizeof(int),
  776. .mode = 0644,
  777. .proc_handler = proc_dointvec_jiffies,
  778. },
  779. {
  780. .procname = "printk_ratelimit_burst",
  781. .data = &printk_ratelimit_state.burst,
  782. .maxlen = sizeof(int),
  783. .mode = 0644,
  784. .proc_handler = proc_dointvec,
  785. },
  786. {
  787. .procname = "printk_delay",
  788. .data = &printk_delay_msec,
  789. .maxlen = sizeof(int),
  790. .mode = 0644,
  791. .proc_handler = proc_dointvec_minmax,
  792. .extra1 = &zero,
  793. .extra2 = &ten_thousand,
  794. },
  795. {
  796. .procname = "printk_devkmsg",
  797. .data = devkmsg_log_str,
  798. .maxlen = DEVKMSG_STR_MAX_SIZE,
  799. .mode = 0644,
  800. .proc_handler = devkmsg_sysctl_set_loglvl,
  801. },
  802. {
  803. .procname = "dmesg_restrict",
  804. .data = &dmesg_restrict,
  805. .maxlen = sizeof(int),
  806. .mode = 0644,
  807. .proc_handler = proc_dointvec_minmax_sysadmin,
  808. .extra1 = &zero,
  809. .extra2 = &one,
  810. },
  811. {
  812. .procname = "kptr_restrict",
  813. .data = &kptr_restrict,
  814. .maxlen = sizeof(int),
  815. .mode = 0644,
  816. .proc_handler = proc_dointvec_minmax_sysadmin,
  817. .extra1 = &zero,
  818. .extra2 = &two,
  819. },
  820. #endif
  821. {
  822. .procname = "ngroups_max",
  823. .data = &ngroups_max,
  824. .maxlen = sizeof (int),
  825. .mode = 0444,
  826. .proc_handler = proc_dointvec,
  827. },
  828. {
  829. .procname = "cap_last_cap",
  830. .data = (void *)&cap_last_cap,
  831. .maxlen = sizeof(int),
  832. .mode = 0444,
  833. .proc_handler = proc_dointvec,
  834. },
  835. #if defined(CONFIG_LOCKUP_DETECTOR)
  836. {
  837. .procname = "watchdog",
  838. .data = &watchdog_user_enabled,
  839. .maxlen = sizeof(int),
  840. .mode = 0644,
  841. .proc_handler = proc_watchdog,
  842. .extra1 = &zero,
  843. .extra2 = &one,
  844. },
  845. {
  846. .procname = "watchdog_thresh",
  847. .data = &watchdog_thresh,
  848. .maxlen = sizeof(int),
  849. .mode = 0644,
  850. .proc_handler = proc_watchdog_thresh,
  851. .extra1 = &zero,
  852. .extra2 = &sixty,
  853. },
  854. {
  855. .procname = "nmi_watchdog",
  856. .data = &nmi_watchdog_user_enabled,
  857. .maxlen = sizeof(int),
  858. .mode = NMI_WATCHDOG_SYSCTL_PERM,
  859. .proc_handler = proc_nmi_watchdog,
  860. .extra1 = &zero,
  861. .extra2 = &one,
  862. },
  863. {
  864. .procname = "watchdog_cpumask",
  865. .data = &watchdog_cpumask_bits,
  866. .maxlen = NR_CPUS,
  867. .mode = 0644,
  868. .proc_handler = proc_watchdog_cpumask,
  869. },
  870. #ifdef CONFIG_SOFTLOCKUP_DETECTOR
  871. {
  872. .procname = "soft_watchdog",
  873. .data = &soft_watchdog_user_enabled,
  874. .maxlen = sizeof(int),
  875. .mode = 0644,
  876. .proc_handler = proc_soft_watchdog,
  877. .extra1 = &zero,
  878. .extra2 = &one,
  879. },
  880. {
  881. .procname = "softlockup_panic",
  882. .data = &softlockup_panic,
  883. .maxlen = sizeof(int),
  884. .mode = 0644,
  885. .proc_handler = proc_dointvec_minmax,
  886. .extra1 = &zero,
  887. .extra2 = &one,
  888. },
  889. #ifdef CONFIG_SMP
  890. {
  891. .procname = "softlockup_all_cpu_backtrace",
  892. .data = &sysctl_softlockup_all_cpu_backtrace,
  893. .maxlen = sizeof(int),
  894. .mode = 0644,
  895. .proc_handler = proc_dointvec_minmax,
  896. .extra1 = &zero,
  897. .extra2 = &one,
  898. },
  899. #endif /* CONFIG_SMP */
  900. #endif
  901. #ifdef CONFIG_HARDLOCKUP_DETECTOR
  902. {
  903. .procname = "hardlockup_panic",
  904. .data = &hardlockup_panic,
  905. .maxlen = sizeof(int),
  906. .mode = 0644,
  907. .proc_handler = proc_dointvec_minmax,
  908. .extra1 = &zero,
  909. .extra2 = &one,
  910. },
  911. #ifdef CONFIG_SMP
  912. {
  913. .procname = "hardlockup_all_cpu_backtrace",
  914. .data = &sysctl_hardlockup_all_cpu_backtrace,
  915. .maxlen = sizeof(int),
  916. .mode = 0644,
  917. .proc_handler = proc_dointvec_minmax,
  918. .extra1 = &zero,
  919. .extra2 = &one,
  920. },
  921. #endif /* CONFIG_SMP */
  922. #endif
  923. #endif
  924. #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  925. {
  926. .procname = "unknown_nmi_panic",
  927. .data = &unknown_nmi_panic,
  928. .maxlen = sizeof (int),
  929. .mode = 0644,
  930. .proc_handler = proc_dointvec,
  931. },
  932. #endif
  933. #if defined(CONFIG_X86)
  934. {
  935. .procname = "panic_on_unrecovered_nmi",
  936. .data = &panic_on_unrecovered_nmi,
  937. .maxlen = sizeof(int),
  938. .mode = 0644,
  939. .proc_handler = proc_dointvec,
  940. },
  941. {
  942. .procname = "panic_on_io_nmi",
  943. .data = &panic_on_io_nmi,
  944. .maxlen = sizeof(int),
  945. .mode = 0644,
  946. .proc_handler = proc_dointvec,
  947. },
  948. #ifdef CONFIG_DEBUG_STACKOVERFLOW
  949. {
  950. .procname = "panic_on_stackoverflow",
  951. .data = &sysctl_panic_on_stackoverflow,
  952. .maxlen = sizeof(int),
  953. .mode = 0644,
  954. .proc_handler = proc_dointvec,
  955. },
  956. #endif
  957. {
  958. .procname = "bootloader_type",
  959. .data = &bootloader_type,
  960. .maxlen = sizeof (int),
  961. .mode = 0444,
  962. .proc_handler = proc_dointvec,
  963. },
  964. {
  965. .procname = "bootloader_version",
  966. .data = &bootloader_version,
  967. .maxlen = sizeof (int),
  968. .mode = 0444,
  969. .proc_handler = proc_dointvec,
  970. },
  971. {
  972. .procname = "io_delay_type",
  973. .data = &io_delay_type,
  974. .maxlen = sizeof(int),
  975. .mode = 0644,
  976. .proc_handler = proc_dointvec,
  977. },
  978. #endif
  979. #if defined(CONFIG_MMU)
  980. {
  981. .procname = "randomize_va_space",
  982. .data = &randomize_va_space,
  983. .maxlen = sizeof(int),
  984. .mode = 0644,
  985. .proc_handler = proc_dointvec,
  986. },
  987. #endif
  988. #if defined(CONFIG_S390) && defined(CONFIG_SMP)
  989. {
  990. .procname = "spin_retry",
  991. .data = &spin_retry,
  992. .maxlen = sizeof (int),
  993. .mode = 0644,
  994. .proc_handler = proc_dointvec,
  995. },
  996. #endif
  997. #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
  998. {
  999. .procname = "acpi_video_flags",
  1000. .data = &acpi_realmode_flags,
  1001. .maxlen = sizeof (unsigned long),
  1002. .mode = 0644,
  1003. .proc_handler = proc_doulongvec_minmax,
  1004. },
  1005. #endif
  1006. #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  1007. {
  1008. .procname = "ignore-unaligned-usertrap",
  1009. .data = &no_unaligned_warning,
  1010. .maxlen = sizeof (int),
  1011. .mode = 0644,
  1012. .proc_handler = proc_dointvec,
  1013. },
  1014. #endif
  1015. #ifdef CONFIG_IA64
  1016. {
  1017. .procname = "unaligned-dump-stack",
  1018. .data = &unaligned_dump_stack,
  1019. .maxlen = sizeof (int),
  1020. .mode = 0644,
  1021. .proc_handler = proc_dointvec,
  1022. },
  1023. #endif
  1024. #ifdef CONFIG_DETECT_HUNG_TASK
  1025. {
  1026. .procname = "hung_task_panic",
  1027. .data = &sysctl_hung_task_panic,
  1028. .maxlen = sizeof(int),
  1029. .mode = 0644,
  1030. .proc_handler = proc_dointvec_minmax,
  1031. .extra1 = &zero,
  1032. .extra2 = &one,
  1033. },
  1034. {
  1035. .procname = "hung_task_check_count",
  1036. .data = &sysctl_hung_task_check_count,
  1037. .maxlen = sizeof(int),
  1038. .mode = 0644,
  1039. .proc_handler = proc_dointvec_minmax,
  1040. .extra1 = &zero,
  1041. },
  1042. {
  1043. .procname = "hung_task_timeout_secs",
  1044. .data = &sysctl_hung_task_timeout_secs,
  1045. .maxlen = sizeof(unsigned long),
  1046. .mode = 0644,
  1047. .proc_handler = proc_dohung_task_timeout_secs,
  1048. .extra2 = &hung_task_timeout_max,
  1049. },
  1050. {
  1051. .procname = "hung_task_warnings",
  1052. .data = &sysctl_hung_task_warnings,
  1053. .maxlen = sizeof(int),
  1054. .mode = 0644,
  1055. .proc_handler = proc_dointvec_minmax,
  1056. .extra1 = &neg_one,
  1057. },
  1058. #endif
  1059. #ifdef CONFIG_RT_MUTEXES
  1060. {
  1061. .procname = "max_lock_depth",
  1062. .data = &max_lock_depth,
  1063. .maxlen = sizeof(int),
  1064. .mode = 0644,
  1065. .proc_handler = proc_dointvec,
  1066. },
  1067. #endif
  1068. {
  1069. .procname = "poweroff_cmd",
  1070. .data = &poweroff_cmd,
  1071. .maxlen = POWEROFF_CMD_PATH_LEN,
  1072. .mode = 0644,
  1073. .proc_handler = proc_dostring,
  1074. },
  1075. #ifdef CONFIG_KEYS
  1076. {
  1077. .procname = "keys",
  1078. .mode = 0555,
  1079. .child = key_sysctls,
  1080. },
  1081. #endif
  1082. #ifdef CONFIG_PERF_EVENTS
  1083. /*
  1084. * User-space scripts rely on the existence of this file
  1085. * as a feature check for perf_events being enabled.
  1086. *
  1087. * So it's an ABI, do not remove!
  1088. */
  1089. {
  1090. .procname = "perf_event_paranoid",
  1091. .data = &sysctl_perf_event_paranoid,
  1092. .maxlen = sizeof(sysctl_perf_event_paranoid),
  1093. .mode = 0644,
  1094. .proc_handler = proc_dointvec,
  1095. },
  1096. {
  1097. .procname = "perf_event_mlock_kb",
  1098. .data = &sysctl_perf_event_mlock,
  1099. .maxlen = sizeof(sysctl_perf_event_mlock),
  1100. .mode = 0644,
  1101. .proc_handler = proc_dointvec,
  1102. },
  1103. {
  1104. .procname = "perf_event_max_sample_rate",
  1105. .data = &sysctl_perf_event_sample_rate,
  1106. .maxlen = sizeof(sysctl_perf_event_sample_rate),
  1107. .mode = 0644,
  1108. .proc_handler = perf_proc_update_handler,
  1109. .extra1 = &one,
  1110. },
  1111. {
  1112. .procname = "perf_cpu_time_max_percent",
  1113. .data = &sysctl_perf_cpu_time_max_percent,
  1114. .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
  1115. .mode = 0644,
  1116. .proc_handler = perf_cpu_time_max_percent_handler,
  1117. .extra1 = &zero,
  1118. .extra2 = &one_hundred,
  1119. },
  1120. {
  1121. .procname = "perf_event_max_stack",
  1122. .data = &sysctl_perf_event_max_stack,
  1123. .maxlen = sizeof(sysctl_perf_event_max_stack),
  1124. .mode = 0644,
  1125. .proc_handler = perf_event_max_stack_handler,
  1126. .extra1 = &zero,
  1127. .extra2 = &six_hundred_forty_kb,
  1128. },
  1129. {
  1130. .procname = "perf_event_max_contexts_per_stack",
  1131. .data = &sysctl_perf_event_max_contexts_per_stack,
  1132. .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
  1133. .mode = 0644,
  1134. .proc_handler = perf_event_max_stack_handler,
  1135. .extra1 = &zero,
  1136. .extra2 = &one_thousand,
  1137. },
  1138. #endif
  1139. {
  1140. .procname = "panic_on_warn",
  1141. .data = &panic_on_warn,
  1142. .maxlen = sizeof(int),
  1143. .mode = 0644,
  1144. .proc_handler = proc_dointvec_minmax,
  1145. .extra1 = &zero,
  1146. .extra2 = &one,
  1147. },
  1148. #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
  1149. {
  1150. .procname = "timer_migration",
  1151. .data = &sysctl_timer_migration,
  1152. .maxlen = sizeof(unsigned int),
  1153. .mode = 0644,
  1154. .proc_handler = timer_migration_handler,
  1155. .extra1 = &zero,
  1156. .extra2 = &one,
  1157. },
  1158. #endif
  1159. #ifdef CONFIG_BPF_SYSCALL
  1160. {
  1161. .procname = "unprivileged_bpf_disabled",
  1162. .data = &sysctl_unprivileged_bpf_disabled,
  1163. .maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
  1164. .mode = 0644,
  1165. /* only handle a transition from default "0" to "1" */
  1166. .proc_handler = proc_dointvec_minmax,
  1167. .extra1 = &one,
  1168. .extra2 = &one,
  1169. },
  1170. #endif
  1171. #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
  1172. {
  1173. .procname = "panic_on_rcu_stall",
  1174. .data = &sysctl_panic_on_rcu_stall,
  1175. .maxlen = sizeof(sysctl_panic_on_rcu_stall),
  1176. .mode = 0644,
  1177. .proc_handler = proc_dointvec_minmax,
  1178. .extra1 = &zero,
  1179. .extra2 = &one,
  1180. },
  1181. #endif
  1182. { }
  1183. };
  1184. static struct ctl_table vm_table[] = {
  1185. {
  1186. .procname = "overcommit_memory",
  1187. .data = &sysctl_overcommit_memory,
  1188. .maxlen = sizeof(sysctl_overcommit_memory),
  1189. .mode = 0644,
  1190. .proc_handler = proc_dointvec_minmax,
  1191. .extra1 = &zero,
  1192. .extra2 = &two,
  1193. },
  1194. {
  1195. .procname = "panic_on_oom",
  1196. .data = &sysctl_panic_on_oom,
  1197. .maxlen = sizeof(sysctl_panic_on_oom),
  1198. .mode = 0644,
  1199. .proc_handler = proc_dointvec_minmax,
  1200. .extra1 = &zero,
  1201. .extra2 = &two,
  1202. },
  1203. {
  1204. .procname = "oom_kill_allocating_task",
  1205. .data = &sysctl_oom_kill_allocating_task,
  1206. .maxlen = sizeof(sysctl_oom_kill_allocating_task),
  1207. .mode = 0644,
  1208. .proc_handler = proc_dointvec,
  1209. },
  1210. {
  1211. .procname = "oom_dump_tasks",
  1212. .data = &sysctl_oom_dump_tasks,
  1213. .maxlen = sizeof(sysctl_oom_dump_tasks),
  1214. .mode = 0644,
  1215. .proc_handler = proc_dointvec,
  1216. },
  1217. {
  1218. .procname = "overcommit_ratio",
  1219. .data = &sysctl_overcommit_ratio,
  1220. .maxlen = sizeof(sysctl_overcommit_ratio),
  1221. .mode = 0644,
  1222. .proc_handler = overcommit_ratio_handler,
  1223. },
  1224. {
  1225. .procname = "overcommit_kbytes",
  1226. .data = &sysctl_overcommit_kbytes,
  1227. .maxlen = sizeof(sysctl_overcommit_kbytes),
  1228. .mode = 0644,
  1229. .proc_handler = overcommit_kbytes_handler,
  1230. },
  1231. {
  1232. .procname = "page-cluster",
  1233. .data = &page_cluster,
  1234. .maxlen = sizeof(int),
  1235. .mode = 0644,
  1236. .proc_handler = proc_dointvec_minmax,
  1237. .extra1 = &zero,
  1238. },
  1239. {
  1240. .procname = "dirty_background_ratio",
  1241. .data = &dirty_background_ratio,
  1242. .maxlen = sizeof(dirty_background_ratio),
  1243. .mode = 0644,
  1244. .proc_handler = dirty_background_ratio_handler,
  1245. .extra1 = &zero,
  1246. .extra2 = &one_hundred,
  1247. },
  1248. {
  1249. .procname = "dirty_background_bytes",
  1250. .data = &dirty_background_bytes,
  1251. .maxlen = sizeof(dirty_background_bytes),
  1252. .mode = 0644,
  1253. .proc_handler = dirty_background_bytes_handler,
  1254. .extra1 = &one_ul,
  1255. },
  1256. {
  1257. .procname = "dirty_ratio",
  1258. .data = &vm_dirty_ratio,
  1259. .maxlen = sizeof(vm_dirty_ratio),
  1260. .mode = 0644,
  1261. .proc_handler = dirty_ratio_handler,
  1262. .extra1 = &zero,
  1263. .extra2 = &one_hundred,
  1264. },
  1265. {
  1266. .procname = "dirty_bytes",
  1267. .data = &vm_dirty_bytes,
  1268. .maxlen = sizeof(vm_dirty_bytes),
  1269. .mode = 0644,
  1270. .proc_handler = dirty_bytes_handler,
  1271. .extra1 = &dirty_bytes_min,
  1272. },
  1273. {
  1274. .procname = "dirty_writeback_centisecs",
  1275. .data = &dirty_writeback_interval,
  1276. .maxlen = sizeof(dirty_writeback_interval),
  1277. .mode = 0644,
  1278. .proc_handler = dirty_writeback_centisecs_handler,
  1279. },
  1280. {
  1281. .procname = "dirty_expire_centisecs",
  1282. .data = &dirty_expire_interval,
  1283. .maxlen = sizeof(dirty_expire_interval),
  1284. .mode = 0644,
  1285. .proc_handler = proc_dointvec_minmax,
  1286. .extra1 = &zero,
  1287. },
  1288. {
  1289. .procname = "dirtytime_expire_seconds",
  1290. .data = &dirtytime_expire_interval,
  1291. .maxlen = sizeof(dirty_expire_interval),
  1292. .mode = 0644,
  1293. .proc_handler = dirtytime_interval_handler,
  1294. .extra1 = &zero,
  1295. },
  1296. {
  1297. .procname = "swappiness",
  1298. .data = &vm_swappiness,
  1299. .maxlen = sizeof(vm_swappiness),
  1300. .mode = 0644,
  1301. .proc_handler = proc_dointvec_minmax,
  1302. .extra1 = &zero,
  1303. .extra2 = &one_hundred,
  1304. },
  1305. #ifdef CONFIG_HUGETLB_PAGE
  1306. {
  1307. .procname = "nr_hugepages",
  1308. .data = NULL,
  1309. .maxlen = sizeof(unsigned long),
  1310. .mode = 0644,
  1311. .proc_handler = hugetlb_sysctl_handler,
  1312. },
  1313. #ifdef CONFIG_NUMA
  1314. {
  1315. .procname = "nr_hugepages_mempolicy",
  1316. .data = NULL,
  1317. .maxlen = sizeof(unsigned long),
  1318. .mode = 0644,
  1319. .proc_handler = &hugetlb_mempolicy_sysctl_handler,
  1320. },
  1321. {
  1322. .procname = "numa_stat",
  1323. .data = &sysctl_vm_numa_stat,
  1324. .maxlen = sizeof(int),
  1325. .mode = 0644,
  1326. .proc_handler = sysctl_vm_numa_stat_handler,
  1327. .extra1 = &zero,
  1328. .extra2 = &one,
  1329. },
  1330. #endif
  1331. {
  1332. .procname = "hugetlb_shm_group",
  1333. .data = &sysctl_hugetlb_shm_group,
  1334. .maxlen = sizeof(gid_t),
  1335. .mode = 0644,
  1336. .proc_handler = proc_dointvec,
  1337. },
  1338. {
  1339. .procname = "hugepages_treat_as_movable",
  1340. .data = &hugepages_treat_as_movable,
  1341. .maxlen = sizeof(int),
  1342. .mode = 0644,
  1343. .proc_handler = proc_dointvec,
  1344. },
  1345. {
  1346. .procname = "nr_overcommit_hugepages",
  1347. .data = NULL,
  1348. .maxlen = sizeof(unsigned long),
  1349. .mode = 0644,
  1350. .proc_handler = hugetlb_overcommit_handler,
  1351. },
  1352. #endif
  1353. {
  1354. .procname = "lowmem_reserve_ratio",
  1355. .data = &sysctl_lowmem_reserve_ratio,
  1356. .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
  1357. .mode = 0644,
  1358. .proc_handler = lowmem_reserve_ratio_sysctl_handler,
  1359. },
  1360. {
  1361. .procname = "drop_caches",
  1362. .data = &sysctl_drop_caches,
  1363. .maxlen = sizeof(int),
  1364. .mode = 0644,
  1365. .proc_handler = drop_caches_sysctl_handler,
  1366. .extra1 = &one,
  1367. .extra2 = &four,
  1368. },
  1369. #ifdef CONFIG_COMPACTION
  1370. {
  1371. .procname = "compact_memory",
  1372. .data = &sysctl_compact_memory,
  1373. .maxlen = sizeof(int),
  1374. .mode = 0200,
  1375. .proc_handler = sysctl_compaction_handler,
  1376. },
  1377. {
  1378. .procname = "extfrag_threshold",
  1379. .data = &sysctl_extfrag_threshold,
  1380. .maxlen = sizeof(int),
  1381. .mode = 0644,
  1382. .proc_handler = sysctl_extfrag_handler,
  1383. .extra1 = &min_extfrag_threshold,
  1384. .extra2 = &max_extfrag_threshold,
  1385. },
  1386. {
  1387. .procname = "compact_unevictable_allowed",
  1388. .data = &sysctl_compact_unevictable_allowed,
  1389. .maxlen = sizeof(int),
  1390. .mode = 0644,
  1391. .proc_handler = proc_dointvec,
  1392. .extra1 = &zero,
  1393. .extra2 = &one,
  1394. },
  1395. #endif /* CONFIG_COMPACTION */
  1396. {
  1397. .procname = "min_free_kbytes",
  1398. .data = &min_free_kbytes,
  1399. .maxlen = sizeof(min_free_kbytes),
  1400. .mode = 0644,
  1401. .proc_handler = min_free_kbytes_sysctl_handler,
  1402. .extra1 = &zero,
  1403. },
  1404. {
  1405. .procname = "watermark_scale_factor",
  1406. .data = &watermark_scale_factor,
  1407. .maxlen = sizeof(watermark_scale_factor),
  1408. .mode = 0644,
  1409. .proc_handler = watermark_scale_factor_sysctl_handler,
  1410. .extra1 = &one,
  1411. .extra2 = &one_thousand,
  1412. },
  1413. {
  1414. .procname = "percpu_pagelist_fraction",
  1415. .data = &percpu_pagelist_fraction,
  1416. .maxlen = sizeof(percpu_pagelist_fraction),
  1417. .mode = 0644,
  1418. .proc_handler = percpu_pagelist_fraction_sysctl_handler,
  1419. .extra1 = &zero,
  1420. },
  1421. #ifdef CONFIG_MMU
  1422. {
  1423. .procname = "max_map_count",
  1424. .data = &sysctl_max_map_count,
  1425. .maxlen = sizeof(sysctl_max_map_count),
  1426. .mode = 0644,
  1427. .proc_handler = proc_dointvec_minmax,
  1428. .extra1 = &zero,
  1429. },
  1430. #else
  1431. {
  1432. .procname = "nr_trim_pages",
  1433. .data = &sysctl_nr_trim_pages,
  1434. .maxlen = sizeof(sysctl_nr_trim_pages),
  1435. .mode = 0644,
  1436. .proc_handler = proc_dointvec_minmax,
  1437. .extra1 = &zero,
  1438. },
  1439. #endif
  1440. {
  1441. .procname = "laptop_mode",
  1442. .data = &laptop_mode,
  1443. .maxlen = sizeof(laptop_mode),
  1444. .mode = 0644,
  1445. .proc_handler = proc_dointvec_jiffies,
  1446. },
  1447. {
  1448. .procname = "block_dump",
  1449. .data = &block_dump,
  1450. .maxlen = sizeof(block_dump),
  1451. .mode = 0644,
  1452. .proc_handler = proc_dointvec,
  1453. .extra1 = &zero,
  1454. },
  1455. {
  1456. .procname = "vfs_cache_pressure",
  1457. .data = &sysctl_vfs_cache_pressure,
  1458. .maxlen = sizeof(sysctl_vfs_cache_pressure),
  1459. .mode = 0644,
  1460. .proc_handler = proc_dointvec,
  1461. .extra1 = &zero,
  1462. },
  1463. #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  1464. {
  1465. .procname = "legacy_va_layout",
  1466. .data = &sysctl_legacy_va_layout,
  1467. .maxlen = sizeof(sysctl_legacy_va_layout),
  1468. .mode = 0644,
  1469. .proc_handler = proc_dointvec,
  1470. .extra1 = &zero,
  1471. },
  1472. #endif
  1473. #ifdef CONFIG_NUMA
  1474. {
  1475. .procname = "zone_reclaim_mode",
  1476. .data = &node_reclaim_mode,
  1477. .maxlen = sizeof(node_reclaim_mode),
  1478. .mode = 0644,
  1479. .proc_handler = proc_dointvec,
  1480. .extra1 = &zero,
  1481. },
  1482. {
  1483. .procname = "min_unmapped_ratio",
  1484. .data = &sysctl_min_unmapped_ratio,
  1485. .maxlen = sizeof(sysctl_min_unmapped_ratio),
  1486. .mode = 0644,
  1487. .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
  1488. .extra1 = &zero,
  1489. .extra2 = &one_hundred,
  1490. },
  1491. {
  1492. .procname = "min_slab_ratio",
  1493. .data = &sysctl_min_slab_ratio,
  1494. .maxlen = sizeof(sysctl_min_slab_ratio),
  1495. .mode = 0644,
  1496. .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
  1497. .extra1 = &zero,
  1498. .extra2 = &one_hundred,
  1499. },
  1500. #endif
  1501. #ifdef CONFIG_SMP
  1502. {
  1503. .procname = "stat_interval",
  1504. .data = &sysctl_stat_interval,
  1505. .maxlen = sizeof(sysctl_stat_interval),
  1506. .mode = 0644,
  1507. .proc_handler = proc_dointvec_jiffies,
  1508. },
  1509. {
  1510. .procname = "stat_refresh",
  1511. .data = NULL,
  1512. .maxlen = 0,
  1513. .mode = 0600,
  1514. .proc_handler = vmstat_refresh,
  1515. },
  1516. #endif
  1517. #ifdef CONFIG_MMU
  1518. {
  1519. .procname = "mmap_min_addr",
  1520. .data = &dac_mmap_min_addr,
  1521. .maxlen = sizeof(unsigned long),
  1522. .mode = 0644,
  1523. .proc_handler = mmap_min_addr_handler,
  1524. },
  1525. #endif
  1526. #ifdef CONFIG_NUMA
  1527. {
  1528. .procname = "numa_zonelist_order",
  1529. .data = &numa_zonelist_order,
  1530. .maxlen = NUMA_ZONELIST_ORDER_LEN,
  1531. .mode = 0644,
  1532. .proc_handler = numa_zonelist_order_handler,
  1533. },
  1534. #endif
  1535. #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
  1536. (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
  1537. {
  1538. .procname = "vdso_enabled",
  1539. #ifdef CONFIG_X86_32
  1540. .data = &vdso32_enabled,
  1541. .maxlen = sizeof(vdso32_enabled),
  1542. #else
  1543. .data = &vdso_enabled,
  1544. .maxlen = sizeof(vdso_enabled),
  1545. #endif
  1546. .mode = 0644,
  1547. .proc_handler = proc_dointvec,
  1548. .extra1 = &zero,
  1549. },
  1550. #endif
  1551. #ifdef CONFIG_HIGHMEM
  1552. {
  1553. .procname = "highmem_is_dirtyable",
  1554. .data = &vm_highmem_is_dirtyable,
  1555. .maxlen = sizeof(vm_highmem_is_dirtyable),
  1556. .mode = 0644,
  1557. .proc_handler = proc_dointvec_minmax,
  1558. .extra1 = &zero,
  1559. .extra2 = &one,
  1560. },
  1561. #endif
  1562. #ifdef CONFIG_MEMORY_FAILURE
  1563. {
  1564. .procname = "memory_failure_early_kill",
  1565. .data = &sysctl_memory_failure_early_kill,
  1566. .maxlen = sizeof(sysctl_memory_failure_early_kill),
  1567. .mode = 0644,
  1568. .proc_handler = proc_dointvec_minmax,
  1569. .extra1 = &zero,
  1570. .extra2 = &one,
  1571. },
  1572. {
  1573. .procname = "memory_failure_recovery",
  1574. .data = &sysctl_memory_failure_recovery,
  1575. .maxlen = sizeof(sysctl_memory_failure_recovery),
  1576. .mode = 0644,
  1577. .proc_handler = proc_dointvec_minmax,
  1578. .extra1 = &zero,
  1579. .extra2 = &one,
  1580. },
  1581. #endif
  1582. {
  1583. .procname = "user_reserve_kbytes",
  1584. .data = &sysctl_user_reserve_kbytes,
  1585. .maxlen = sizeof(sysctl_user_reserve_kbytes),
  1586. .mode = 0644,
  1587. .proc_handler = proc_doulongvec_minmax,
  1588. },
  1589. {
  1590. .procname = "admin_reserve_kbytes",
  1591. .data = &sysctl_admin_reserve_kbytes,
  1592. .maxlen = sizeof(sysctl_admin_reserve_kbytes),
  1593. .mode = 0644,
  1594. .proc_handler = proc_doulongvec_minmax,
  1595. },
  1596. #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
  1597. {
  1598. .procname = "mmap_rnd_bits",
  1599. .data = &mmap_rnd_bits,
  1600. .maxlen = sizeof(mmap_rnd_bits),
  1601. .mode = 0600,
  1602. .proc_handler = proc_dointvec_minmax,
  1603. .extra1 = (void *)&mmap_rnd_bits_min,
  1604. .extra2 = (void *)&mmap_rnd_bits_max,
  1605. },
  1606. #endif
  1607. #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
  1608. {
  1609. .procname = "mmap_rnd_compat_bits",
  1610. .data = &mmap_rnd_compat_bits,
  1611. .maxlen = sizeof(mmap_rnd_compat_bits),
  1612. .mode = 0600,
  1613. .proc_handler = proc_dointvec_minmax,
  1614. .extra1 = (void *)&mmap_rnd_compat_bits_min,
  1615. .extra2 = (void *)&mmap_rnd_compat_bits_max,
  1616. },
  1617. #endif
  1618. { }
  1619. };
  1620. static struct ctl_table fs_table[] = {
  1621. {
  1622. .procname = "inode-nr",
  1623. .data = &inodes_stat,
  1624. .maxlen = 2*sizeof(long),
  1625. .mode = 0444,
  1626. .proc_handler = proc_nr_inodes,
  1627. },
  1628. {
  1629. .procname = "inode-state",
  1630. .data = &inodes_stat,
  1631. .maxlen = 7*sizeof(long),
  1632. .mode = 0444,
  1633. .proc_handler = proc_nr_inodes,
  1634. },
  1635. {
  1636. .procname = "file-nr",
  1637. .data = &files_stat,
  1638. .maxlen = sizeof(files_stat),
  1639. .mode = 0444,
  1640. .proc_handler = proc_nr_files,
  1641. },
  1642. {
  1643. .procname = "file-max",
  1644. .data = &files_stat.max_files,
  1645. .maxlen = sizeof(files_stat.max_files),
  1646. .mode = 0644,
  1647. .proc_handler = proc_doulongvec_minmax,
  1648. },
  1649. {
  1650. .procname = "nr_open",
  1651. .data = &sysctl_nr_open,
  1652. .maxlen = sizeof(unsigned int),
  1653. .mode = 0644,
  1654. .proc_handler = proc_dointvec_minmax,
  1655. .extra1 = &sysctl_nr_open_min,
  1656. .extra2 = &sysctl_nr_open_max,
  1657. },
  1658. {
  1659. .procname = "dentry-state",
  1660. .data = &dentry_stat,
  1661. .maxlen = 6*sizeof(long),
  1662. .mode = 0444,
  1663. .proc_handler = proc_nr_dentry,
  1664. },
  1665. {
  1666. .procname = "overflowuid",
  1667. .data = &fs_overflowuid,
  1668. .maxlen = sizeof(int),
  1669. .mode = 0644,
  1670. .proc_handler = proc_dointvec_minmax,
  1671. .extra1 = &minolduid,
  1672. .extra2 = &maxolduid,
  1673. },
  1674. {
  1675. .procname = "overflowgid",
  1676. .data = &fs_overflowgid,
  1677. .maxlen = sizeof(int),
  1678. .mode = 0644,
  1679. .proc_handler = proc_dointvec_minmax,
  1680. .extra1 = &minolduid,
  1681. .extra2 = &maxolduid,
  1682. },
  1683. #ifdef CONFIG_FILE_LOCKING
  1684. {
  1685. .procname = "leases-enable",
  1686. .data = &leases_enable,
  1687. .maxlen = sizeof(int),
  1688. .mode = 0644,
  1689. .proc_handler = proc_dointvec,
  1690. },
  1691. #endif
  1692. #ifdef CONFIG_DNOTIFY
  1693. {
  1694. .procname = "dir-notify-enable",
  1695. .data = &dir_notify_enable,
  1696. .maxlen = sizeof(int),
  1697. .mode = 0644,
  1698. .proc_handler = proc_dointvec,
  1699. },
  1700. #endif
  1701. #ifdef CONFIG_MMU
  1702. #ifdef CONFIG_FILE_LOCKING
  1703. {
  1704. .procname = "lease-break-time",
  1705. .data = &lease_break_time,
  1706. .maxlen = sizeof(int),
  1707. .mode = 0644,
  1708. .proc_handler = proc_dointvec,
  1709. },
  1710. #endif
  1711. #ifdef CONFIG_AIO
  1712. {
  1713. .procname = "aio-nr",
  1714. .data = &aio_nr,
  1715. .maxlen = sizeof(aio_nr),
  1716. .mode = 0444,
  1717. .proc_handler = proc_doulongvec_minmax,
  1718. },
  1719. {
  1720. .procname = "aio-max-nr",
  1721. .data = &aio_max_nr,
  1722. .maxlen = sizeof(aio_max_nr),
  1723. .mode = 0644,
  1724. .proc_handler = proc_doulongvec_minmax,
  1725. },
  1726. #endif /* CONFIG_AIO */
  1727. #ifdef CONFIG_INOTIFY_USER
  1728. {
  1729. .procname = "inotify",
  1730. .mode = 0555,
  1731. .child = inotify_table,
  1732. },
  1733. #endif
  1734. #ifdef CONFIG_EPOLL
  1735. {
  1736. .procname = "epoll",
  1737. .mode = 0555,
  1738. .child = epoll_table,
  1739. },
  1740. #endif
  1741. #endif
  1742. {
  1743. .procname = "protected_symlinks",
  1744. .data = &sysctl_protected_symlinks,
  1745. .maxlen = sizeof(int),
  1746. .mode = 0600,
  1747. .proc_handler = proc_dointvec_minmax,
  1748. .extra1 = &zero,
  1749. .extra2 = &one,
  1750. },
  1751. {
  1752. .procname = "protected_hardlinks",
  1753. .data = &sysctl_protected_hardlinks,
  1754. .maxlen = sizeof(int),
  1755. .mode = 0600,
  1756. .proc_handler = proc_dointvec_minmax,
  1757. .extra1 = &zero,
  1758. .extra2 = &one,
  1759. },
  1760. {
  1761. .procname = "suid_dumpable",
  1762. .data = &suid_dumpable,
  1763. .maxlen = sizeof(int),
  1764. .mode = 0644,
  1765. .proc_handler = proc_dointvec_minmax_coredump,
  1766. .extra1 = &zero,
  1767. .extra2 = &two,
  1768. },
  1769. #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  1770. {
  1771. .procname = "binfmt_misc",
  1772. .mode = 0555,
  1773. .child = sysctl_mount_point,
  1774. },
  1775. #endif
  1776. {
  1777. .procname = "pipe-max-size",
  1778. .data = &pipe_max_size,
  1779. .maxlen = sizeof(pipe_max_size),
  1780. .mode = 0644,
  1781. .proc_handler = &pipe_proc_fn,
  1782. .extra1 = &pipe_min_size,
  1783. },
  1784. {
  1785. .procname = "pipe-user-pages-hard",
  1786. .data = &pipe_user_pages_hard,
  1787. .maxlen = sizeof(pipe_user_pages_hard),
  1788. .mode = 0644,
  1789. .proc_handler = proc_doulongvec_minmax,
  1790. },
  1791. {
  1792. .procname = "pipe-user-pages-soft",
  1793. .data = &pipe_user_pages_soft,
  1794. .maxlen = sizeof(pipe_user_pages_soft),
  1795. .mode = 0644,
  1796. .proc_handler = proc_doulongvec_minmax,
  1797. },
  1798. {
  1799. .procname = "mount-max",
  1800. .data = &sysctl_mount_max,
  1801. .maxlen = sizeof(unsigned int),
  1802. .mode = 0644,
  1803. .proc_handler = proc_dointvec_minmax,
  1804. .extra1 = &one,
  1805. },
  1806. { }
  1807. };
  1808. static struct ctl_table debug_table[] = {
  1809. #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
  1810. {
  1811. .procname = "exception-trace",
  1812. .data = &show_unhandled_signals,
  1813. .maxlen = sizeof(int),
  1814. .mode = 0644,
  1815. .proc_handler = proc_dointvec
  1816. },
  1817. #endif
  1818. #if defined(CONFIG_OPTPROBES)
  1819. {
  1820. .procname = "kprobes-optimization",
  1821. .data = &sysctl_kprobes_optimization,
  1822. .maxlen = sizeof(int),
  1823. .mode = 0644,
  1824. .proc_handler = proc_kprobes_optimization_handler,
  1825. .extra1 = &zero,
  1826. .extra2 = &one,
  1827. },
  1828. #endif
  1829. { }
  1830. };
  1831. static struct ctl_table dev_table[] = {
  1832. { }
  1833. };
  1834. int __init sysctl_init(void)
  1835. {
  1836. struct ctl_table_header *hdr;
  1837. hdr = register_sysctl_table(sysctl_base_table);
  1838. kmemleak_not_leak(hdr);
  1839. return 0;
  1840. }
  1841. #endif /* CONFIG_SYSCTL */
  1842. /*
  1843. * /proc/sys support
  1844. */
  1845. #ifdef CONFIG_PROC_SYSCTL
  1846. static int _proc_do_string(char *data, int maxlen, int write,
  1847. char __user *buffer,
  1848. size_t *lenp, loff_t *ppos)
  1849. {
  1850. size_t len;
  1851. char __user *p;
  1852. char c;
  1853. if (!data || !maxlen || !*lenp) {
  1854. *lenp = 0;
  1855. return 0;
  1856. }
  1857. if (write) {
  1858. if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
  1859. /* Only continue writes not past the end of buffer. */
  1860. len = strlen(data);
  1861. if (len > maxlen - 1)
  1862. len = maxlen - 1;
  1863. if (*ppos > len)
  1864. return 0;
  1865. len = *ppos;
  1866. } else {
  1867. /* Start writing from beginning of buffer. */
  1868. len = 0;
  1869. }
  1870. *ppos += *lenp;
  1871. p = buffer;
  1872. while ((p - buffer) < *lenp && len < maxlen - 1) {
  1873. if (get_user(c, p++))
  1874. return -EFAULT;
  1875. if (c == 0 || c == '\n')
  1876. break;
  1877. data[len++] = c;
  1878. }
  1879. data[len] = 0;
  1880. } else {
  1881. len = strlen(data);
  1882. if (len > maxlen)
  1883. len = maxlen;
  1884. if (*ppos > len) {
  1885. *lenp = 0;
  1886. return 0;
  1887. }
  1888. data += *ppos;
  1889. len -= *ppos;
  1890. if (len > *lenp)
  1891. len = *lenp;
  1892. if (len)
  1893. if (copy_to_user(buffer, data, len))
  1894. return -EFAULT;
  1895. if (len < *lenp) {
  1896. if (put_user('\n', buffer + len))
  1897. return -EFAULT;
  1898. len++;
  1899. }
  1900. *lenp = len;
  1901. *ppos += len;
  1902. }
  1903. return 0;
  1904. }
  1905. static void warn_sysctl_write(struct ctl_table *table)
  1906. {
  1907. pr_warn_once("%s wrote to %s when file position was not 0!\n"
  1908. "This will not be supported in the future. To silence this\n"
  1909. "warning, set kernel.sysctl_writes_strict = -1\n",
  1910. current->comm, table->procname);
  1911. }
  1912. /**
  1913. * proc_first_pos_non_zero_ignore - check if firs position is allowed
  1914. * @ppos: file position
  1915. * @table: the sysctl table
  1916. *
  1917. * Returns true if the first position is non-zero and the sysctl_writes_strict
  1918. * mode indicates this is not allowed for numeric input types. String proc
  1919. * hadlers can ignore the return value.
  1920. */
  1921. static bool proc_first_pos_non_zero_ignore(loff_t *ppos,
  1922. struct ctl_table *table)
  1923. {
  1924. if (!*ppos)
  1925. return false;
  1926. switch (sysctl_writes_strict) {
  1927. case SYSCTL_WRITES_STRICT:
  1928. return true;
  1929. case SYSCTL_WRITES_WARN:
  1930. warn_sysctl_write(table);
  1931. return false;
  1932. default:
  1933. return false;
  1934. }
  1935. }
  1936. /**
  1937. * proc_dostring - read a string sysctl
  1938. * @table: the sysctl table
  1939. * @write: %TRUE if this is a write to the sysctl file
  1940. * @buffer: the user buffer
  1941. * @lenp: the size of the user buffer
  1942. * @ppos: file position
  1943. *
  1944. * Reads/writes a string from/to the user buffer. If the kernel
  1945. * buffer provided is not large enough to hold the string, the
  1946. * string is truncated. The copied string is %NULL-terminated.
  1947. * If the string is being read by the user process, it is copied
  1948. * and a newline '\n' is added. It is truncated if the buffer is
  1949. * not large enough.
  1950. *
  1951. * Returns 0 on success.
  1952. */
  1953. int proc_dostring(struct ctl_table *table, int write,
  1954. void __user *buffer, size_t *lenp, loff_t *ppos)
  1955. {
  1956. if (write)
  1957. proc_first_pos_non_zero_ignore(ppos, table);
  1958. return _proc_do_string((char *)(table->data), table->maxlen, write,
  1959. (char __user *)buffer, lenp, ppos);
  1960. }
  1961. static size_t proc_skip_spaces(char **buf)
  1962. {
  1963. size_t ret;
  1964. char *tmp = skip_spaces(*buf);
  1965. ret = tmp - *buf;
  1966. *buf = tmp;
  1967. return ret;
  1968. }
  1969. static void proc_skip_char(char **buf, size_t *size, const char v)
  1970. {
  1971. while (*size) {
  1972. if (**buf != v)
  1973. break;
  1974. (*size)--;
  1975. (*buf)++;
  1976. }
  1977. }
  1978. #define TMPBUFLEN 22
  1979. /**
  1980. * proc_get_long - reads an ASCII formatted integer from a user buffer
  1981. *
  1982. * @buf: a kernel buffer
  1983. * @size: size of the kernel buffer
  1984. * @val: this is where the number will be stored
  1985. * @neg: set to %TRUE if number is negative
  1986. * @perm_tr: a vector which contains the allowed trailers
  1987. * @perm_tr_len: size of the perm_tr vector
  1988. * @tr: pointer to store the trailer character
  1989. *
  1990. * In case of success %0 is returned and @buf and @size are updated with
  1991. * the amount of bytes read. If @tr is non-NULL and a trailing
  1992. * character exists (size is non-zero after returning from this
  1993. * function), @tr is updated with the trailing character.
  1994. */
  1995. static int proc_get_long(char **buf, size_t *size,
  1996. unsigned long *val, bool *neg,
  1997. const char *perm_tr, unsigned perm_tr_len, char *tr)
  1998. {
  1999. int len;
  2000. char *p, tmp[TMPBUFLEN];
  2001. if (!*size)
  2002. return -EINVAL;
  2003. len = *size;
  2004. if (len > TMPBUFLEN - 1)
  2005. len = TMPBUFLEN - 1;
  2006. memcpy(tmp, *buf, len);
  2007. tmp[len] = 0;
  2008. p = tmp;
  2009. if (*p == '-' && *size > 1) {
  2010. *neg = true;
  2011. p++;
  2012. } else
  2013. *neg = false;
  2014. if (!isdigit(*p))
  2015. return -EINVAL;
  2016. *val = simple_strtoul(p, &p, 0);
  2017. len = p - tmp;
  2018. /* We don't know if the next char is whitespace thus we may accept
  2019. * invalid integers (e.g. 1234...a) or two integers instead of one
  2020. * (e.g. 123...1). So lets not allow such large numbers. */
  2021. if (len == TMPBUFLEN - 1)
  2022. return -EINVAL;
  2023. if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
  2024. return -EINVAL;
  2025. if (tr && (len < *size))
  2026. *tr = *p;
  2027. *buf += len;
  2028. *size -= len;
  2029. return 0;
  2030. }
  2031. /**
  2032. * proc_put_long - converts an integer to a decimal ASCII formatted string
  2033. *
  2034. * @buf: the user buffer
  2035. * @size: the size of the user buffer
  2036. * @val: the integer to be converted
  2037. * @neg: sign of the number, %TRUE for negative
  2038. *
  2039. * In case of success %0 is returned and @buf and @size are updated with
  2040. * the amount of bytes written.
  2041. */
  2042. static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
  2043. bool neg)
  2044. {
  2045. int len;
  2046. char tmp[TMPBUFLEN], *p = tmp;
  2047. sprintf(p, "%s%lu", neg ? "-" : "", val);
  2048. len = strlen(tmp);
  2049. if (len > *size)
  2050. len = *size;
  2051. if (copy_to_user(*buf, tmp, len))
  2052. return -EFAULT;
  2053. *size -= len;
  2054. *buf += len;
  2055. return 0;
  2056. }
  2057. #undef TMPBUFLEN
  2058. static int proc_put_char(void __user **buf, size_t *size, char c)
  2059. {
  2060. if (*size) {
  2061. char __user **buffer = (char __user **)buf;
  2062. if (put_user(c, *buffer))
  2063. return -EFAULT;
  2064. (*size)--, (*buffer)++;
  2065. *buf = *buffer;
  2066. }
  2067. return 0;
  2068. }
  2069. static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
  2070. int *valp,
  2071. int write, void *data)
  2072. {
  2073. if (write) {
  2074. if (*negp) {
  2075. if (*lvalp > (unsigned long) INT_MAX + 1)
  2076. return -EINVAL;
  2077. *valp = -*lvalp;
  2078. } else {
  2079. if (*lvalp > (unsigned long) INT_MAX)
  2080. return -EINVAL;
  2081. *valp = *lvalp;
  2082. }
  2083. } else {
  2084. int val = *valp;
  2085. if (val < 0) {
  2086. *negp = true;
  2087. *lvalp = -(unsigned long)val;
  2088. } else {
  2089. *negp = false;
  2090. *lvalp = (unsigned long)val;
  2091. }
  2092. }
  2093. return 0;
  2094. }
  2095. static int do_proc_douintvec_conv(unsigned long *lvalp,
  2096. unsigned int *valp,
  2097. int write, void *data)
  2098. {
  2099. if (write) {
  2100. if (*lvalp > UINT_MAX)
  2101. return -EINVAL;
  2102. *valp = *lvalp;
  2103. } else {
  2104. unsigned int val = *valp;
  2105. *lvalp = (unsigned long)val;
  2106. }
  2107. return 0;
  2108. }
  2109. static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
  2110. static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
  2111. int write, void __user *buffer,
  2112. size_t *lenp, loff_t *ppos,
  2113. int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
  2114. int write, void *data),
  2115. void *data)
  2116. {
  2117. int *i, vleft, first = 1, err = 0;
  2118. size_t left;
  2119. char *kbuf = NULL, *p;
  2120. if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2121. *lenp = 0;
  2122. return 0;
  2123. }
  2124. i = (int *) tbl_data;
  2125. vleft = table->maxlen / sizeof(*i);
  2126. left = *lenp;
  2127. if (!conv)
  2128. conv = do_proc_dointvec_conv;
  2129. if (write) {
  2130. if (proc_first_pos_non_zero_ignore(ppos, table))
  2131. goto out;
  2132. if (left > PAGE_SIZE - 1)
  2133. left = PAGE_SIZE - 1;
  2134. p = kbuf = memdup_user_nul(buffer, left);
  2135. if (IS_ERR(kbuf))
  2136. return PTR_ERR(kbuf);
  2137. }
  2138. for (; left && vleft--; i++, first=0) {
  2139. unsigned long lval;
  2140. bool neg;
  2141. if (write) {
  2142. left -= proc_skip_spaces(&p);
  2143. if (!left)
  2144. break;
  2145. err = proc_get_long(&p, &left, &lval, &neg,
  2146. proc_wspace_sep,
  2147. sizeof(proc_wspace_sep), NULL);
  2148. if (err)
  2149. break;
  2150. if (conv(&neg, &lval, i, 1, data)) {
  2151. err = -EINVAL;
  2152. break;
  2153. }
  2154. } else {
  2155. if (conv(&neg, &lval, i, 0, data)) {
  2156. err = -EINVAL;
  2157. break;
  2158. }
  2159. if (!first)
  2160. err = proc_put_char(&buffer, &left, '\t');
  2161. if (err)
  2162. break;
  2163. err = proc_put_long(&buffer, &left, lval, neg);
  2164. if (err)
  2165. break;
  2166. }
  2167. }
  2168. if (!write && !first && left && !err)
  2169. err = proc_put_char(&buffer, &left, '\n');
  2170. if (write && !err && left)
  2171. left -= proc_skip_spaces(&p);
  2172. if (write) {
  2173. kfree(kbuf);
  2174. if (first)
  2175. return err ? : -EINVAL;
  2176. }
  2177. *lenp -= left;
  2178. out:
  2179. *ppos += *lenp;
  2180. return err;
  2181. }
  2182. static int do_proc_dointvec(struct ctl_table *table, int write,
  2183. void __user *buffer, size_t *lenp, loff_t *ppos,
  2184. int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
  2185. int write, void *data),
  2186. void *data)
  2187. {
  2188. return __do_proc_dointvec(table->data, table, write,
  2189. buffer, lenp, ppos, conv, data);
  2190. }
  2191. static int do_proc_douintvec_w(unsigned int *tbl_data,
  2192. struct ctl_table *table,
  2193. void __user *buffer,
  2194. size_t *lenp, loff_t *ppos,
  2195. int (*conv)(unsigned long *lvalp,
  2196. unsigned int *valp,
  2197. int write, void *data),
  2198. void *data)
  2199. {
  2200. unsigned long lval;
  2201. int err = 0;
  2202. size_t left;
  2203. bool neg;
  2204. char *kbuf = NULL, *p;
  2205. left = *lenp;
  2206. if (proc_first_pos_non_zero_ignore(ppos, table))
  2207. goto bail_early;
  2208. if (left > PAGE_SIZE - 1)
  2209. left = PAGE_SIZE - 1;
  2210. p = kbuf = memdup_user_nul(buffer, left);
  2211. if (IS_ERR(kbuf))
  2212. return -EINVAL;
  2213. left -= proc_skip_spaces(&p);
  2214. if (!left) {
  2215. err = -EINVAL;
  2216. goto out_free;
  2217. }
  2218. err = proc_get_long(&p, &left, &lval, &neg,
  2219. proc_wspace_sep,
  2220. sizeof(proc_wspace_sep), NULL);
  2221. if (err || neg) {
  2222. err = -EINVAL;
  2223. goto out_free;
  2224. }
  2225. if (conv(&lval, tbl_data, 1, data)) {
  2226. err = -EINVAL;
  2227. goto out_free;
  2228. }
  2229. if (!err && left)
  2230. left -= proc_skip_spaces(&p);
  2231. out_free:
  2232. kfree(kbuf);
  2233. if (err)
  2234. return -EINVAL;
  2235. return 0;
  2236. /* This is in keeping with old __do_proc_dointvec() */
  2237. bail_early:
  2238. *ppos += *lenp;
  2239. return err;
  2240. }
  2241. static int do_proc_douintvec_r(unsigned int *tbl_data, void __user *buffer,
  2242. size_t *lenp, loff_t *ppos,
  2243. int (*conv)(unsigned long *lvalp,
  2244. unsigned int *valp,
  2245. int write, void *data),
  2246. void *data)
  2247. {
  2248. unsigned long lval;
  2249. int err = 0;
  2250. size_t left;
  2251. left = *lenp;
  2252. if (conv(&lval, tbl_data, 0, data)) {
  2253. err = -EINVAL;
  2254. goto out;
  2255. }
  2256. err = proc_put_long(&buffer, &left, lval, false);
  2257. if (err || !left)
  2258. goto out;
  2259. err = proc_put_char(&buffer, &left, '\n');
  2260. out:
  2261. *lenp -= left;
  2262. *ppos += *lenp;
  2263. return err;
  2264. }
  2265. static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table,
  2266. int write, void __user *buffer,
  2267. size_t *lenp, loff_t *ppos,
  2268. int (*conv)(unsigned long *lvalp,
  2269. unsigned int *valp,
  2270. int write, void *data),
  2271. void *data)
  2272. {
  2273. unsigned int *i, vleft;
  2274. if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2275. *lenp = 0;
  2276. return 0;
  2277. }
  2278. i = (unsigned int *) tbl_data;
  2279. vleft = table->maxlen / sizeof(*i);
  2280. /*
  2281. * Arrays are not supported, keep this simple. *Do not* add
  2282. * support for them.
  2283. */
  2284. if (vleft != 1) {
  2285. *lenp = 0;
  2286. return -EINVAL;
  2287. }
  2288. if (!conv)
  2289. conv = do_proc_douintvec_conv;
  2290. if (write)
  2291. return do_proc_douintvec_w(i, table, buffer, lenp, ppos,
  2292. conv, data);
  2293. return do_proc_douintvec_r(i, buffer, lenp, ppos, conv, data);
  2294. }
  2295. static int do_proc_douintvec(struct ctl_table *table, int write,
  2296. void __user *buffer, size_t *lenp, loff_t *ppos,
  2297. int (*conv)(unsigned long *lvalp,
  2298. unsigned int *valp,
  2299. int write, void *data),
  2300. void *data)
  2301. {
  2302. return __do_proc_douintvec(table->data, table, write,
  2303. buffer, lenp, ppos, conv, data);
  2304. }
  2305. /**
  2306. * proc_dointvec - read a vector of integers
  2307. * @table: the sysctl table
  2308. * @write: %TRUE if this is a write to the sysctl file
  2309. * @buffer: the user buffer
  2310. * @lenp: the size of the user buffer
  2311. * @ppos: file position
  2312. *
  2313. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2314. * values from/to the user buffer, treated as an ASCII string.
  2315. *
  2316. * Returns 0 on success.
  2317. */
  2318. int proc_dointvec(struct ctl_table *table, int write,
  2319. void __user *buffer, size_t *lenp, loff_t *ppos)
  2320. {
  2321. return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
  2322. }
  2323. /**
  2324. * proc_douintvec - read a vector of unsigned integers
  2325. * @table: the sysctl table
  2326. * @write: %TRUE if this is a write to the sysctl file
  2327. * @buffer: the user buffer
  2328. * @lenp: the size of the user buffer
  2329. * @ppos: file position
  2330. *
  2331. * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
  2332. * values from/to the user buffer, treated as an ASCII string.
  2333. *
  2334. * Returns 0 on success.
  2335. */
  2336. int proc_douintvec(struct ctl_table *table, int write,
  2337. void __user *buffer, size_t *lenp, loff_t *ppos)
  2338. {
  2339. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2340. do_proc_douintvec_conv, NULL);
  2341. }
  2342. /*
  2343. * Taint values can only be increased
  2344. * This means we can safely use a temporary.
  2345. */
  2346. static int proc_taint(struct ctl_table *table, int write,
  2347. void __user *buffer, size_t *lenp, loff_t *ppos)
  2348. {
  2349. struct ctl_table t;
  2350. unsigned long tmptaint = get_taint();
  2351. int err;
  2352. if (write && !capable(CAP_SYS_ADMIN))
  2353. return -EPERM;
  2354. t = *table;
  2355. t.data = &tmptaint;
  2356. err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
  2357. if (err < 0)
  2358. return err;
  2359. if (write) {
  2360. /*
  2361. * Poor man's atomic or. Not worth adding a primitive
  2362. * to everyone's atomic.h for this
  2363. */
  2364. int i;
  2365. for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
  2366. if ((tmptaint >> i) & 1)
  2367. add_taint(i, LOCKDEP_STILL_OK);
  2368. }
  2369. }
  2370. return err;
  2371. }
  2372. #ifdef CONFIG_PRINTK
  2373. static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
  2374. void __user *buffer, size_t *lenp, loff_t *ppos)
  2375. {
  2376. if (write && !capable(CAP_SYS_ADMIN))
  2377. return -EPERM;
  2378. return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  2379. }
  2380. #endif
  2381. struct do_proc_dointvec_minmax_conv_param {
  2382. int *min;
  2383. int *max;
  2384. };
  2385. static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
  2386. int *valp,
  2387. int write, void *data)
  2388. {
  2389. struct do_proc_dointvec_minmax_conv_param *param = data;
  2390. if (write) {
  2391. int val = *negp ? -*lvalp : *lvalp;
  2392. if ((param->min && *param->min > val) ||
  2393. (param->max && *param->max < val))
  2394. return -EINVAL;
  2395. *valp = val;
  2396. } else {
  2397. int val = *valp;
  2398. if (val < 0) {
  2399. *negp = true;
  2400. *lvalp = -(unsigned long)val;
  2401. } else {
  2402. *negp = false;
  2403. *lvalp = (unsigned long)val;
  2404. }
  2405. }
  2406. return 0;
  2407. }
  2408. /**
  2409. * proc_dointvec_minmax - read a vector of integers with min/max values
  2410. * @table: the sysctl table
  2411. * @write: %TRUE if this is a write to the sysctl file
  2412. * @buffer: the user buffer
  2413. * @lenp: the size of the user buffer
  2414. * @ppos: file position
  2415. *
  2416. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2417. * values from/to the user buffer, treated as an ASCII string.
  2418. *
  2419. * This routine will ensure the values are within the range specified by
  2420. * table->extra1 (min) and table->extra2 (max).
  2421. *
  2422. * Returns 0 on success.
  2423. */
  2424. int proc_dointvec_minmax(struct ctl_table *table, int write,
  2425. void __user *buffer, size_t *lenp, loff_t *ppos)
  2426. {
  2427. struct do_proc_dointvec_minmax_conv_param param = {
  2428. .min = (int *) table->extra1,
  2429. .max = (int *) table->extra2,
  2430. };
  2431. return do_proc_dointvec(table, write, buffer, lenp, ppos,
  2432. do_proc_dointvec_minmax_conv, &param);
  2433. }
  2434. struct do_proc_douintvec_minmax_conv_param {
  2435. unsigned int *min;
  2436. unsigned int *max;
  2437. };
  2438. static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
  2439. unsigned int *valp,
  2440. int write, void *data)
  2441. {
  2442. struct do_proc_douintvec_minmax_conv_param *param = data;
  2443. if (write) {
  2444. unsigned int val = *lvalp;
  2445. if (*lvalp > UINT_MAX)
  2446. return -EINVAL;
  2447. if ((param->min && *param->min > val) ||
  2448. (param->max && *param->max < val))
  2449. return -ERANGE;
  2450. *valp = val;
  2451. } else {
  2452. unsigned int val = *valp;
  2453. *lvalp = (unsigned long) val;
  2454. }
  2455. return 0;
  2456. }
  2457. /**
  2458. * proc_douintvec_minmax - read a vector of unsigned ints with min/max values
  2459. * @table: the sysctl table
  2460. * @write: %TRUE if this is a write to the sysctl file
  2461. * @buffer: the user buffer
  2462. * @lenp: the size of the user buffer
  2463. * @ppos: file position
  2464. *
  2465. * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
  2466. * values from/to the user buffer, treated as an ASCII string. Negative
  2467. * strings are not allowed.
  2468. *
  2469. * This routine will ensure the values are within the range specified by
  2470. * table->extra1 (min) and table->extra2 (max). There is a final sanity
  2471. * check for UINT_MAX to avoid having to support wrap around uses from
  2472. * userspace.
  2473. *
  2474. * Returns 0 on success.
  2475. */
  2476. int proc_douintvec_minmax(struct ctl_table *table, int write,
  2477. void __user *buffer, size_t *lenp, loff_t *ppos)
  2478. {
  2479. struct do_proc_douintvec_minmax_conv_param param = {
  2480. .min = (unsigned int *) table->extra1,
  2481. .max = (unsigned int *) table->extra2,
  2482. };
  2483. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2484. do_proc_douintvec_minmax_conv, &param);
  2485. }
  2486. struct do_proc_dopipe_max_size_conv_param {
  2487. unsigned int *min;
  2488. };
  2489. static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
  2490. unsigned int *valp,
  2491. int write, void *data)
  2492. {
  2493. struct do_proc_dopipe_max_size_conv_param *param = data;
  2494. if (write) {
  2495. unsigned int val;
  2496. if (*lvalp > UINT_MAX)
  2497. return -EINVAL;
  2498. val = round_pipe_size(*lvalp);
  2499. if (val == 0)
  2500. return -EINVAL;
  2501. if (param->min && *param->min > val)
  2502. return -ERANGE;
  2503. *valp = val;
  2504. } else {
  2505. unsigned int val = *valp;
  2506. *lvalp = (unsigned long) val;
  2507. }
  2508. return 0;
  2509. }
  2510. int proc_dopipe_max_size(struct ctl_table *table, int write,
  2511. void __user *buffer, size_t *lenp, loff_t *ppos)
  2512. {
  2513. struct do_proc_dopipe_max_size_conv_param param = {
  2514. .min = (unsigned int *) table->extra1,
  2515. };
  2516. return do_proc_douintvec(table, write, buffer, lenp, ppos,
  2517. do_proc_dopipe_max_size_conv, &param);
  2518. }
  2519. static void validate_coredump_safety(void)
  2520. {
  2521. #ifdef CONFIG_COREDUMP
  2522. if (suid_dumpable == SUID_DUMP_ROOT &&
  2523. core_pattern[0] != '/' && core_pattern[0] != '|') {
  2524. printk(KERN_WARNING
  2525. "Unsafe core_pattern used with fs.suid_dumpable=2.\n"
  2526. "Pipe handler or fully qualified core dump path required.\n"
  2527. "Set kernel.core_pattern before fs.suid_dumpable.\n"
  2528. );
  2529. }
  2530. #endif
  2531. }
  2532. static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  2533. void __user *buffer, size_t *lenp, loff_t *ppos)
  2534. {
  2535. int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  2536. if (!error)
  2537. validate_coredump_safety();
  2538. return error;
  2539. }
  2540. #ifdef CONFIG_COREDUMP
  2541. static int proc_dostring_coredump(struct ctl_table *table, int write,
  2542. void __user *buffer, size_t *lenp, loff_t *ppos)
  2543. {
  2544. int error = proc_dostring(table, write, buffer, lenp, ppos);
  2545. if (!error)
  2546. validate_coredump_safety();
  2547. return error;
  2548. }
  2549. #endif
  2550. static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
  2551. void __user *buffer,
  2552. size_t *lenp, loff_t *ppos,
  2553. unsigned long convmul,
  2554. unsigned long convdiv)
  2555. {
  2556. unsigned long *i, *min, *max;
  2557. int vleft, first = 1, err = 0;
  2558. size_t left;
  2559. char *kbuf = NULL, *p;
  2560. if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
  2561. *lenp = 0;
  2562. return 0;
  2563. }
  2564. i = (unsigned long *) data;
  2565. min = (unsigned long *) table->extra1;
  2566. max = (unsigned long *) table->extra2;
  2567. vleft = table->maxlen / sizeof(unsigned long);
  2568. left = *lenp;
  2569. if (write) {
  2570. if (proc_first_pos_non_zero_ignore(ppos, table))
  2571. goto out;
  2572. if (left > PAGE_SIZE - 1)
  2573. left = PAGE_SIZE - 1;
  2574. p = kbuf = memdup_user_nul(buffer, left);
  2575. if (IS_ERR(kbuf))
  2576. return PTR_ERR(kbuf);
  2577. }
  2578. for (; left && vleft--; i++, first = 0) {
  2579. unsigned long val;
  2580. if (write) {
  2581. bool neg;
  2582. left -= proc_skip_spaces(&p);
  2583. err = proc_get_long(&p, &left, &val, &neg,
  2584. proc_wspace_sep,
  2585. sizeof(proc_wspace_sep), NULL);
  2586. if (err)
  2587. break;
  2588. if (neg)
  2589. continue;
  2590. val = convmul * val / convdiv;
  2591. if ((min && val < *min) || (max && val > *max))
  2592. continue;
  2593. *i = val;
  2594. } else {
  2595. val = convdiv * (*i) / convmul;
  2596. if (!first) {
  2597. err = proc_put_char(&buffer, &left, '\t');
  2598. if (err)
  2599. break;
  2600. }
  2601. err = proc_put_long(&buffer, &left, val, false);
  2602. if (err)
  2603. break;
  2604. }
  2605. }
  2606. if (!write && !first && left && !err)
  2607. err = proc_put_char(&buffer, &left, '\n');
  2608. if (write && !err)
  2609. left -= proc_skip_spaces(&p);
  2610. if (write) {
  2611. kfree(kbuf);
  2612. if (first)
  2613. return err ? : -EINVAL;
  2614. }
  2615. *lenp -= left;
  2616. out:
  2617. *ppos += *lenp;
  2618. return err;
  2619. }
  2620. static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
  2621. void __user *buffer,
  2622. size_t *lenp, loff_t *ppos,
  2623. unsigned long convmul,
  2624. unsigned long convdiv)
  2625. {
  2626. return __do_proc_doulongvec_minmax(table->data, table, write,
  2627. buffer, lenp, ppos, convmul, convdiv);
  2628. }
  2629. /**
  2630. * proc_doulongvec_minmax - read a vector of long integers with min/max values
  2631. * @table: the sysctl table
  2632. * @write: %TRUE if this is a write to the sysctl file
  2633. * @buffer: the user buffer
  2634. * @lenp: the size of the user buffer
  2635. * @ppos: file position
  2636. *
  2637. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2638. * values from/to the user buffer, treated as an ASCII string.
  2639. *
  2640. * This routine will ensure the values are within the range specified by
  2641. * table->extra1 (min) and table->extra2 (max).
  2642. *
  2643. * Returns 0 on success.
  2644. */
  2645. int proc_doulongvec_minmax(struct ctl_table *table, int write,
  2646. void __user *buffer, size_t *lenp, loff_t *ppos)
  2647. {
  2648. return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
  2649. }
  2650. /**
  2651. * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
  2652. * @table: the sysctl table
  2653. * @write: %TRUE if this is a write to the sysctl file
  2654. * @buffer: the user buffer
  2655. * @lenp: the size of the user buffer
  2656. * @ppos: file position
  2657. *
  2658. * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
  2659. * values from/to the user buffer, treated as an ASCII string. The values
  2660. * are treated as milliseconds, and converted to jiffies when they are stored.
  2661. *
  2662. * This routine will ensure the values are within the range specified by
  2663. * table->extra1 (min) and table->extra2 (max).
  2664. *
  2665. * Returns 0 on success.
  2666. */
  2667. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  2668. void __user *buffer,
  2669. size_t *lenp, loff_t *ppos)
  2670. {
  2671. return do_proc_doulongvec_minmax(table, write, buffer,
  2672. lenp, ppos, HZ, 1000l);
  2673. }
  2674. static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
  2675. int *valp,
  2676. int write, void *data)
  2677. {
  2678. if (write) {
  2679. if (*lvalp > INT_MAX / HZ)
  2680. return 1;
  2681. *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  2682. } else {
  2683. int val = *valp;
  2684. unsigned long lval;
  2685. if (val < 0) {
  2686. *negp = true;
  2687. lval = -(unsigned long)val;
  2688. } else {
  2689. *negp = false;
  2690. lval = (unsigned long)val;
  2691. }
  2692. *lvalp = lval / HZ;
  2693. }
  2694. return 0;
  2695. }
  2696. static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
  2697. int *valp,
  2698. int write, void *data)
  2699. {
  2700. if (write) {
  2701. if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  2702. return 1;
  2703. *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  2704. } else {
  2705. int val = *valp;
  2706. unsigned long lval;
  2707. if (val < 0) {
  2708. *negp = true;
  2709. lval = -(unsigned long)val;
  2710. } else {
  2711. *negp = false;
  2712. lval = (unsigned long)val;
  2713. }
  2714. *lvalp = jiffies_to_clock_t(lval);
  2715. }
  2716. return 0;
  2717. }
  2718. static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
  2719. int *valp,
  2720. int write, void *data)
  2721. {
  2722. if (write) {
  2723. unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  2724. if (jif > INT_MAX)
  2725. return 1;
  2726. *valp = (int)jif;
  2727. } else {
  2728. int val = *valp;
  2729. unsigned long lval;
  2730. if (val < 0) {
  2731. *negp = true;
  2732. lval = -(unsigned long)val;
  2733. } else {
  2734. *negp = false;
  2735. lval = (unsigned long)val;
  2736. }
  2737. *lvalp = jiffies_to_msecs(lval);
  2738. }
  2739. return 0;
  2740. }
  2741. /**
  2742. * proc_dointvec_jiffies - read a vector of integers as seconds
  2743. * @table: the sysctl table
  2744. * @write: %TRUE if this is a write to the sysctl file
  2745. * @buffer: the user buffer
  2746. * @lenp: the size of the user buffer
  2747. * @ppos: file position
  2748. *
  2749. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2750. * values from/to the user buffer, treated as an ASCII string.
  2751. * The values read are assumed to be in seconds, and are converted into
  2752. * jiffies.
  2753. *
  2754. * Returns 0 on success.
  2755. */
  2756. int proc_dointvec_jiffies(struct ctl_table *table, int write,
  2757. void __user *buffer, size_t *lenp, loff_t *ppos)
  2758. {
  2759. return do_proc_dointvec(table,write,buffer,lenp,ppos,
  2760. do_proc_dointvec_jiffies_conv,NULL);
  2761. }
  2762. /**
  2763. * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
  2764. * @table: the sysctl table
  2765. * @write: %TRUE if this is a write to the sysctl file
  2766. * @buffer: the user buffer
  2767. * @lenp: the size of the user buffer
  2768. * @ppos: pointer to the file position
  2769. *
  2770. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2771. * values from/to the user buffer, treated as an ASCII string.
  2772. * The values read are assumed to be in 1/USER_HZ seconds, and
  2773. * are converted into jiffies.
  2774. *
  2775. * Returns 0 on success.
  2776. */
  2777. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
  2778. void __user *buffer, size_t *lenp, loff_t *ppos)
  2779. {
  2780. return do_proc_dointvec(table,write,buffer,lenp,ppos,
  2781. do_proc_dointvec_userhz_jiffies_conv,NULL);
  2782. }
  2783. /**
  2784. * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
  2785. * @table: the sysctl table
  2786. * @write: %TRUE if this is a write to the sysctl file
  2787. * @buffer: the user buffer
  2788. * @lenp: the size of the user buffer
  2789. * @ppos: file position
  2790. * @ppos: the current position in the file
  2791. *
  2792. * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
  2793. * values from/to the user buffer, treated as an ASCII string.
  2794. * The values read are assumed to be in 1/1000 seconds, and
  2795. * are converted into jiffies.
  2796. *
  2797. * Returns 0 on success.
  2798. */
  2799. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
  2800. void __user *buffer, size_t *lenp, loff_t *ppos)
  2801. {
  2802. return do_proc_dointvec(table, write, buffer, lenp, ppos,
  2803. do_proc_dointvec_ms_jiffies_conv, NULL);
  2804. }
  2805. static int proc_do_cad_pid(struct ctl_table *table, int write,
  2806. void __user *buffer, size_t *lenp, loff_t *ppos)
  2807. {
  2808. struct pid *new_pid;
  2809. pid_t tmp;
  2810. int r;
  2811. tmp = pid_vnr(cad_pid);
  2812. r = __do_proc_dointvec(&tmp, table, write, buffer,
  2813. lenp, ppos, NULL, NULL);
  2814. if (r || !write)
  2815. return r;
  2816. new_pid = find_get_pid(tmp);
  2817. if (!new_pid)
  2818. return -ESRCH;
  2819. put_pid(xchg(&cad_pid, new_pid));
  2820. return 0;
  2821. }
  2822. /**
  2823. * proc_do_large_bitmap - read/write from/to a large bitmap
  2824. * @table: the sysctl table
  2825. * @write: %TRUE if this is a write to the sysctl file
  2826. * @buffer: the user buffer
  2827. * @lenp: the size of the user buffer
  2828. * @ppos: file position
  2829. *
  2830. * The bitmap is stored at table->data and the bitmap length (in bits)
  2831. * in table->maxlen.
  2832. *
  2833. * We use a range comma separated format (e.g. 1,3-4,10-10) so that
  2834. * large bitmaps may be represented in a compact manner. Writing into
  2835. * the file will clear the bitmap then update it with the given input.
  2836. *
  2837. * Returns 0 on success.
  2838. */
  2839. int proc_do_large_bitmap(struct ctl_table *table, int write,
  2840. void __user *buffer, size_t *lenp, loff_t *ppos)
  2841. {
  2842. int err = 0;
  2843. bool first = 1;
  2844. size_t left = *lenp;
  2845. unsigned long bitmap_len = table->maxlen;
  2846. unsigned long *bitmap = *(unsigned long **) table->data;
  2847. unsigned long *tmp_bitmap = NULL;
  2848. char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
  2849. if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
  2850. *lenp = 0;
  2851. return 0;
  2852. }
  2853. if (write) {
  2854. char *kbuf, *p;
  2855. if (left > PAGE_SIZE - 1)
  2856. left = PAGE_SIZE - 1;
  2857. p = kbuf = memdup_user_nul(buffer, left);
  2858. if (IS_ERR(kbuf))
  2859. return PTR_ERR(kbuf);
  2860. tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
  2861. GFP_KERNEL);
  2862. if (!tmp_bitmap) {
  2863. kfree(kbuf);
  2864. return -ENOMEM;
  2865. }
  2866. proc_skip_char(&p, &left, '\n');
  2867. while (!err && left) {
  2868. unsigned long val_a, val_b;
  2869. bool neg;
  2870. err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
  2871. sizeof(tr_a), &c);
  2872. if (err)
  2873. break;
  2874. if (val_a >= bitmap_len || neg) {
  2875. err = -EINVAL;
  2876. break;
  2877. }
  2878. val_b = val_a;
  2879. if (left) {
  2880. p++;
  2881. left--;
  2882. }
  2883. if (c == '-') {
  2884. err = proc_get_long(&p, &left, &val_b,
  2885. &neg, tr_b, sizeof(tr_b),
  2886. &c);
  2887. if (err)
  2888. break;
  2889. if (val_b >= bitmap_len || neg ||
  2890. val_a > val_b) {
  2891. err = -EINVAL;
  2892. break;
  2893. }
  2894. if (left) {
  2895. p++;
  2896. left--;
  2897. }
  2898. }
  2899. bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
  2900. first = 0;
  2901. proc_skip_char(&p, &left, '\n');
  2902. }
  2903. kfree(kbuf);
  2904. } else {
  2905. unsigned long bit_a, bit_b = 0;
  2906. while (left) {
  2907. bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
  2908. if (bit_a >= bitmap_len)
  2909. break;
  2910. bit_b = find_next_zero_bit(bitmap, bitmap_len,
  2911. bit_a + 1) - 1;
  2912. if (!first) {
  2913. err = proc_put_char(&buffer, &left, ',');
  2914. if (err)
  2915. break;
  2916. }
  2917. err = proc_put_long(&buffer, &left, bit_a, false);
  2918. if (err)
  2919. break;
  2920. if (bit_a != bit_b) {
  2921. err = proc_put_char(&buffer, &left, '-');
  2922. if (err)
  2923. break;
  2924. err = proc_put_long(&buffer, &left, bit_b, false);
  2925. if (err)
  2926. break;
  2927. }
  2928. first = 0; bit_b++;
  2929. }
  2930. if (!err)
  2931. err = proc_put_char(&buffer, &left, '\n');
  2932. }
  2933. if (!err) {
  2934. if (write) {
  2935. if (*ppos)
  2936. bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
  2937. else
  2938. bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
  2939. }
  2940. *lenp -= left;
  2941. *ppos += *lenp;
  2942. }
  2943. kfree(tmp_bitmap);
  2944. return err;
  2945. }
  2946. #else /* CONFIG_PROC_SYSCTL */
  2947. int proc_dostring(struct ctl_table *table, int write,
  2948. void __user *buffer, size_t *lenp, loff_t *ppos)
  2949. {
  2950. return -ENOSYS;
  2951. }
  2952. int proc_dointvec(struct ctl_table *table, int write,
  2953. void __user *buffer, size_t *lenp, loff_t *ppos)
  2954. {
  2955. return -ENOSYS;
  2956. }
  2957. int proc_douintvec(struct ctl_table *table, int write,
  2958. void __user *buffer, size_t *lenp, loff_t *ppos)
  2959. {
  2960. return -ENOSYS;
  2961. }
  2962. int proc_dointvec_minmax(struct ctl_table *table, int write,
  2963. void __user *buffer, size_t *lenp, loff_t *ppos)
  2964. {
  2965. return -ENOSYS;
  2966. }
  2967. int proc_douintvec_minmax(struct ctl_table *table, int write,
  2968. void __user *buffer, size_t *lenp, loff_t *ppos)
  2969. {
  2970. return -ENOSYS;
  2971. }
  2972. int proc_dopipe_max_size(struct ctl_table *table, int write,
  2973. void __user *buffer, size_t *lenp, loff_t *ppos)
  2974. {
  2975. return -ENOSYS;
  2976. }
  2977. int proc_dointvec_jiffies(struct ctl_table *table, int write,
  2978. void __user *buffer, size_t *lenp, loff_t *ppos)
  2979. {
  2980. return -ENOSYS;
  2981. }
  2982. int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
  2983. void __user *buffer, size_t *lenp, loff_t *ppos)
  2984. {
  2985. return -ENOSYS;
  2986. }
  2987. int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
  2988. void __user *buffer, size_t *lenp, loff_t *ppos)
  2989. {
  2990. return -ENOSYS;
  2991. }
  2992. int proc_doulongvec_minmax(struct ctl_table *table, int write,
  2993. void __user *buffer, size_t *lenp, loff_t *ppos)
  2994. {
  2995. return -ENOSYS;
  2996. }
  2997. int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
  2998. void __user *buffer,
  2999. size_t *lenp, loff_t *ppos)
  3000. {
  3001. return -ENOSYS;
  3002. }
  3003. #endif /* CONFIG_PROC_SYSCTL */
  3004. /*
  3005. * No sense putting this after each symbol definition, twice,
  3006. * exception granted :-)
  3007. */
  3008. EXPORT_SYMBOL(proc_dointvec);
  3009. EXPORT_SYMBOL(proc_douintvec);
  3010. EXPORT_SYMBOL(proc_dointvec_jiffies);
  3011. EXPORT_SYMBOL(proc_dointvec_minmax);
  3012. EXPORT_SYMBOL_GPL(proc_douintvec_minmax);
  3013. EXPORT_SYMBOL_GPL(proc_dopipe_max_size);
  3014. EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  3015. EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  3016. EXPORT_SYMBOL(proc_dostring);
  3017. EXPORT_SYMBOL(proc_doulongvec_minmax);
  3018. EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);