11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * sysctl.c: General linux system control interface 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Begun 24 March 1995, Stephen Tweedie 51da177e4SLinus Torvalds * Added /proc support, Dec 1995 61da177e4SLinus Torvalds * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas. 71da177e4SLinus Torvalds * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver. 81da177e4SLinus Torvalds * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver. 91da177e4SLinus Torvalds * Dynamic registration fixes, Stephen Tweedie. 101da177e4SLinus Torvalds * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn. 111da177e4SLinus Torvalds * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris 121da177e4SLinus Torvalds * Horn. 131da177e4SLinus Torvalds * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer. 141da177e4SLinus Torvalds * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer. 151da177e4SLinus Torvalds * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill 161da177e4SLinus Torvalds * Wendling. 171da177e4SLinus Torvalds * The list_for_each() macro wasn't appropriate for the sysctl loop. 181da177e4SLinus Torvalds * Removed it and replaced it with older style, 03/23/00, Bill Wendling 191da177e4SLinus Torvalds */ 201da177e4SLinus Torvalds 211da177e4SLinus Torvalds #include <linux/module.h> 221da177e4SLinus Torvalds #include <linux/mm.h> 231da177e4SLinus Torvalds #include <linux/swap.h> 241da177e4SLinus Torvalds #include <linux/slab.h> 251da177e4SLinus Torvalds #include <linux/sysctl.h> 26d33ed52dSDave Young #include <linux/signal.h> 271da177e4SLinus Torvalds #include <linux/proc_fs.h> 2872c2d582SAndrew Morgan #include <linux/security.h> 291da177e4SLinus Torvalds #include <linux/ctype.h> 30dfec072eSVegard Nossum #include <linux/kmemcheck.h> 3162239ac2SAdrian Bunk #include <linux/fs.h> 321da177e4SLinus Torvalds #include <linux/init.h> 331da177e4SLinus Torvalds #include <linux/kernel.h> 340296b228SKay Sievers #include <linux/kobject.h> 3520380731SArnaldo Carvalho de Melo #include <linux/net.h> 361da177e4SLinus Torvalds #include <linux/sysrq.h> 371da177e4SLinus Torvalds #include <linux/highuid.h> 381da177e4SLinus Torvalds #include <linux/writeback.h> 393fff4c42SIngo Molnar #include <linux/ratelimit.h> 401da177e4SLinus Torvalds #include <linux/hugetlb.h> 411da177e4SLinus Torvalds #include <linux/initrd.h> 420b77f5bfSDavid Howells #include <linux/key.h> 431da177e4SLinus Torvalds #include <linux/times.h> 441da177e4SLinus Torvalds #include <linux/limits.h> 451da177e4SLinus Torvalds #include <linux/dcache.h> 461da177e4SLinus Torvalds #include <linux/syscalls.h> 47c748e134SAdrian Bunk #include <linux/vmstat.h> 48c255d844SPavel Machek #include <linux/nfs_fs.h> 49c255d844SPavel Machek #include <linux/acpi.h> 5010a0a8d4SJeremy Fitzhardinge #include <linux/reboot.h> 51b0fc494fSSteven Rostedt #include <linux/ftrace.h> 5212e22c5eSDavid Howells #include <linux/slow-work.h> 53cdd6c482SIngo Molnar #include <linux/perf_event.h> 54b2be84dfSMasami Hiramatsu #include <linux/kprobes.h> 551da177e4SLinus Torvalds 561da177e4SLinus Torvalds #include <asm/uaccess.h> 571da177e4SLinus Torvalds #include <asm/processor.h> 581da177e4SLinus Torvalds 5929cbc78bSAndi Kleen #ifdef CONFIG_X86 6029cbc78bSAndi Kleen #include <asm/nmi.h> 610741f4d2SChuck Ebbert #include <asm/stacktrace.h> 626e7c4025SIngo Molnar #include <asm/io.h> 6329cbc78bSAndi Kleen #endif 64c55b7c3eSDave Young #ifdef CONFIG_BSD_PROCESS_ACCT 65c55b7c3eSDave Young #include <linux/acct.h> 66c55b7c3eSDave Young #endif 674f0e056fSDave Young #ifdef CONFIG_RT_MUTEXES 684f0e056fSDave Young #include <linux/rtmutex.h> 694f0e056fSDave Young #endif 702edf5e49SDave Young #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) 712edf5e49SDave Young #include <linux/lockdep.h> 722edf5e49SDave Young #endif 7315485a46SDave Young #ifdef CONFIG_CHR_DEV_SG 7415485a46SDave Young #include <scsi/sg.h> 7515485a46SDave Young #endif 7629cbc78bSAndi Kleen 77*58687acbSDon Zickus #ifdef CONFIG_LOCKUP_DETECTOR 78504d7cf1SDon Zickus #include <linux/nmi.h> 79504d7cf1SDon Zickus #endif 80504d7cf1SDon Zickus 817058cb02SEric W. Biederman 821da177e4SLinus Torvalds #if defined(CONFIG_SYSCTL) 831da177e4SLinus Torvalds 841da177e4SLinus Torvalds /* External variables not in a header file. */ 851da177e4SLinus Torvalds extern int sysctl_overcommit_memory; 861da177e4SLinus Torvalds extern int sysctl_overcommit_ratio; 87fadd8fbdSKAMEZAWA Hiroyuki extern int sysctl_panic_on_oom; 88fe071d7eSDavid Rientjes extern int sysctl_oom_kill_allocating_task; 89fef1bdd6SDavid Rientjes extern int sysctl_oom_dump_tasks; 901da177e4SLinus Torvalds extern int max_threads; 911da177e4SLinus Torvalds extern int core_uses_pid; 92d6e71144SAlan Cox extern int suid_dumpable; 931da177e4SLinus Torvalds extern char core_pattern[]; 94a293980cSNeil Horman extern unsigned int core_pipe_limit; 951da177e4SLinus Torvalds extern int pid_max; 961da177e4SLinus Torvalds extern int min_free_kbytes; 971da177e4SLinus Torvalds extern int pid_max_min, pid_max_max; 989d0243bcSAndrew Morton extern int sysctl_drop_caches; 998ad4b1fbSRohit Seth extern int percpu_pagelist_fraction; 100bebfa101SAndi Kleen extern int compat_log; 1019745512cSArjan van de Ven extern int latencytop_enabled; 102eceea0b3SAl Viro extern int sysctl_nr_open_min, sysctl_nr_open_max; 103dd8632a1SPaul Mundt #ifndef CONFIG_MMU 104dd8632a1SPaul Mundt extern int sysctl_nr_trim_pages; 105dd8632a1SPaul Mundt #endif 106cb684b5bSJens Axboe #ifdef CONFIG_BLOCK 1075e605b64SJens Axboe extern int blk_iopoll_enabled; 108cb684b5bSJens Axboe #endif 1091da177e4SLinus Torvalds 110c4f3b63fSRavikiran G Thirumalai /* Constants used for minimum and maximum */ 111195cf453SBron Gondwana #ifdef CONFIG_DETECT_SOFTLOCKUP 112c4f3b63fSRavikiran G Thirumalai static int sixty = 60; 1139383d967SDimitri Sivanich static int neg_one = -1; 114c4f3b63fSRavikiran G Thirumalai #endif 115c4f3b63fSRavikiran G Thirumalai 116c4f3b63fSRavikiran G Thirumalai static int zero; 117cd5f9a4cSLinus Torvalds static int __maybe_unused one = 1; 118cd5f9a4cSLinus Torvalds static int __maybe_unused two = 2; 119fc3501d4SSven Wegener static unsigned long one_ul = 1; 120c4f3b63fSRavikiran G Thirumalai static int one_hundred = 100; 121af91322eSDave Young #ifdef CONFIG_PRINTK 122af91322eSDave Young static int ten_thousand = 10000; 123af91322eSDave Young #endif 124c4f3b63fSRavikiran G Thirumalai 1259e4a5bdaSAndrea Righi /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ 1269e4a5bdaSAndrea Righi static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; 1279e4a5bdaSAndrea Righi 1281da177e4SLinus Torvalds /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 1291da177e4SLinus Torvalds static int maxolduid = 65535; 1301da177e4SLinus Torvalds static int minolduid; 1318ad4b1fbSRohit Seth static int min_percpu_pagelist_fract = 8; 1321da177e4SLinus Torvalds 1331da177e4SLinus Torvalds static int ngroups_max = NGROUPS_MAX; 1341da177e4SLinus Torvalds 13572c57ed5SDavid S. Miller #ifdef CONFIG_SPARC 13617f04fbbSDavid S. Miller #include <asm/system.h> 1371da177e4SLinus Torvalds #endif 1381da177e4SLinus Torvalds 1390871420fSDavid S. Miller #ifdef CONFIG_SPARC64 1400871420fSDavid S. Miller extern int sysctl_tsb_ratio; 1410871420fSDavid S. Miller #endif 1420871420fSDavid S. Miller 1431da177e4SLinus Torvalds #ifdef __hppa__ 1441da177e4SLinus Torvalds extern int pwrsw_enabled; 1451da177e4SLinus Torvalds extern int unaligned_enabled; 1461da177e4SLinus Torvalds #endif 1471da177e4SLinus Torvalds 148347a8dc3SMartin Schwidefsky #ifdef CONFIG_S390 1491da177e4SLinus Torvalds #ifdef CONFIG_MATHEMU 1501da177e4SLinus Torvalds extern int sysctl_ieee_emulation_warnings; 1511da177e4SLinus Torvalds #endif 1521da177e4SLinus Torvalds extern int sysctl_userprocess_debug; 153951f22d5SMartin Schwidefsky extern int spin_retry; 1541da177e4SLinus Torvalds #endif 1551da177e4SLinus Torvalds 156d2b176edSJes Sorensen #ifdef CONFIG_IA64 157d2b176edSJes Sorensen extern int no_unaligned_warning; 15888fc241fSDoug Chapman extern int unaligned_dump_stack; 159d2b176edSJes Sorensen #endif 160d2b176edSJes Sorensen 1613fff4c42SIngo Molnar extern struct ratelimit_state printk_ratelimit_state; 1623fff4c42SIngo Molnar 163d6f8ff73SRandy Dunlap #ifdef CONFIG_PROC_SYSCTL 1648d65af78SAlexey Dobriyan static int proc_do_cad_pid(struct ctl_table *table, int write, 1659ec52099SCedric Le Goater void __user *buffer, size_t *lenp, loff_t *ppos); 1668d65af78SAlexey Dobriyan static int proc_taint(struct ctl_table *table, int write, 16734f5a398STheodore Ts'o void __user *buffer, size_t *lenp, loff_t *ppos); 168d6f8ff73SRandy Dunlap #endif 1699ec52099SCedric Le Goater 170d8217f07SEric W. Biederman static struct ctl_table root_table[]; 171e51b6ba0SEric W. Biederman static struct ctl_table_root sysctl_table_root; 172e51b6ba0SEric W. Biederman static struct ctl_table_header root_table_header = { 173b380b0d4SAl Viro .count = 1, 174e51b6ba0SEric W. Biederman .ctl_table = root_table, 17573455092SAl Viro .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list), 176e51b6ba0SEric W. Biederman .root = &sysctl_table_root, 17773455092SAl Viro .set = &sysctl_table_root.default_set, 178e51b6ba0SEric W. Biederman }; 179e51b6ba0SEric W. Biederman static struct ctl_table_root sysctl_table_root = { 180e51b6ba0SEric W. Biederman .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list), 18173455092SAl Viro .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry), 182e51b6ba0SEric W. Biederman }; 1831da177e4SLinus Torvalds 184d8217f07SEric W. Biederman static struct ctl_table kern_table[]; 185d8217f07SEric W. Biederman static struct ctl_table vm_table[]; 186d8217f07SEric W. Biederman static struct ctl_table fs_table[]; 187d8217f07SEric W. Biederman static struct ctl_table debug_table[]; 188d8217f07SEric W. Biederman static struct ctl_table dev_table[]; 189d8217f07SEric W. Biederman extern struct ctl_table random_table[]; 1902d9048e2SAmy Griffis #ifdef CONFIG_INOTIFY_USER 191d8217f07SEric W. Biederman extern struct ctl_table inotify_table[]; 1920399cb08SRobert Love #endif 1937ef9964eSDavide Libenzi #ifdef CONFIG_EPOLL 1947ef9964eSDavide Libenzi extern struct ctl_table epoll_table[]; 1957ef9964eSDavide Libenzi #endif 1961da177e4SLinus Torvalds 1971da177e4SLinus Torvalds #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 1981da177e4SLinus Torvalds int sysctl_legacy_va_layout; 1991da177e4SLinus Torvalds #endif 2001da177e4SLinus Torvalds 2011da177e4SLinus Torvalds /* The default sysctl tables: */ 2021da177e4SLinus Torvalds 203d8217f07SEric W. Biederman static struct ctl_table root_table[] = { 2041da177e4SLinus Torvalds { 2051da177e4SLinus Torvalds .procname = "kernel", 2061da177e4SLinus Torvalds .mode = 0555, 2071da177e4SLinus Torvalds .child = kern_table, 2081da177e4SLinus Torvalds }, 2091da177e4SLinus Torvalds { 2101da177e4SLinus Torvalds .procname = "vm", 2111da177e4SLinus Torvalds .mode = 0555, 2121da177e4SLinus Torvalds .child = vm_table, 2131da177e4SLinus Torvalds }, 2141da177e4SLinus Torvalds { 2151da177e4SLinus Torvalds .procname = "fs", 2161da177e4SLinus Torvalds .mode = 0555, 2171da177e4SLinus Torvalds .child = fs_table, 2181da177e4SLinus Torvalds }, 2191da177e4SLinus Torvalds { 2201da177e4SLinus Torvalds .procname = "debug", 2211da177e4SLinus Torvalds .mode = 0555, 2221da177e4SLinus Torvalds .child = debug_table, 2231da177e4SLinus Torvalds }, 2241da177e4SLinus Torvalds { 2251da177e4SLinus Torvalds .procname = "dev", 2261da177e4SLinus Torvalds .mode = 0555, 2271da177e4SLinus Torvalds .child = dev_table, 2281da177e4SLinus Torvalds }, 2292be7fe07SAndrew Morton /* 2302be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 2312be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 2322be7fe07SAndrew Morton */ 2336fce56ecSEric W. Biederman { } 2341da177e4SLinus Torvalds }; 2351da177e4SLinus Torvalds 23677e54a1fSIngo Molnar #ifdef CONFIG_SCHED_DEBUG 23773c4efd2SEric Dumazet static int min_sched_granularity_ns = 100000; /* 100 usecs */ 23873c4efd2SEric Dumazet static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 23973c4efd2SEric Dumazet static int min_wakeup_granularity_ns; /* 0 usecs */ 24073c4efd2SEric Dumazet static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 2411983a922SChristian Ehrhardt static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; 2421983a922SChristian Ehrhardt static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; 243acb4a848SChristian Ehrhardt static int min_sched_shares_ratelimit = 100000; /* 100 usec */ 244acb4a848SChristian Ehrhardt static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ 24577e54a1fSIngo Molnar #endif 24677e54a1fSIngo Molnar 247d8217f07SEric W. Biederman static struct ctl_table kern_table[] = { 2482bba22c5SMike Galbraith { 2492bba22c5SMike Galbraith .procname = "sched_child_runs_first", 2502bba22c5SMike Galbraith .data = &sysctl_sched_child_runs_first, 2512bba22c5SMike Galbraith .maxlen = sizeof(unsigned int), 2522bba22c5SMike Galbraith .mode = 0644, 2536d456111SEric W. Biederman .proc_handler = proc_dointvec, 2542bba22c5SMike Galbraith }, 25577e54a1fSIngo Molnar #ifdef CONFIG_SCHED_DEBUG 25677e54a1fSIngo Molnar { 257b2be5e96SPeter Zijlstra .procname = "sched_min_granularity_ns", 258b2be5e96SPeter Zijlstra .data = &sysctl_sched_min_granularity, 25977e54a1fSIngo Molnar .maxlen = sizeof(unsigned int), 26077e54a1fSIngo Molnar .mode = 0644, 261702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 262b2be5e96SPeter Zijlstra .extra1 = &min_sched_granularity_ns, 263b2be5e96SPeter Zijlstra .extra2 = &max_sched_granularity_ns, 26477e54a1fSIngo Molnar }, 26577e54a1fSIngo Molnar { 26621805085SPeter Zijlstra .procname = "sched_latency_ns", 26721805085SPeter Zijlstra .data = &sysctl_sched_latency, 26821805085SPeter Zijlstra .maxlen = sizeof(unsigned int), 26921805085SPeter Zijlstra .mode = 0644, 270702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 27121805085SPeter Zijlstra .extra1 = &min_sched_granularity_ns, 27221805085SPeter Zijlstra .extra2 = &max_sched_granularity_ns, 27321805085SPeter Zijlstra }, 27421805085SPeter Zijlstra { 27577e54a1fSIngo Molnar .procname = "sched_wakeup_granularity_ns", 27677e54a1fSIngo Molnar .data = &sysctl_sched_wakeup_granularity, 27777e54a1fSIngo Molnar .maxlen = sizeof(unsigned int), 27877e54a1fSIngo Molnar .mode = 0644, 279702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 28077e54a1fSIngo Molnar .extra1 = &min_wakeup_granularity_ns, 28177e54a1fSIngo Molnar .extra2 = &max_wakeup_granularity_ns, 28277e54a1fSIngo Molnar }, 28377e54a1fSIngo Molnar { 2842398f2c6SPeter Zijlstra .procname = "sched_shares_ratelimit", 2852398f2c6SPeter Zijlstra .data = &sysctl_sched_shares_ratelimit, 2862398f2c6SPeter Zijlstra .maxlen = sizeof(unsigned int), 2872398f2c6SPeter Zijlstra .mode = 0644, 288702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 289acb4a848SChristian Ehrhardt .extra1 = &min_sched_shares_ratelimit, 290acb4a848SChristian Ehrhardt .extra2 = &max_sched_shares_ratelimit, 2912398f2c6SPeter Zijlstra }, 2922398f2c6SPeter Zijlstra { 2931983a922SChristian Ehrhardt .procname = "sched_tunable_scaling", 2941983a922SChristian Ehrhardt .data = &sysctl_sched_tunable_scaling, 2951983a922SChristian Ehrhardt .maxlen = sizeof(enum sched_tunable_scaling), 2961983a922SChristian Ehrhardt .mode = 0644, 297702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 2981983a922SChristian Ehrhardt .extra1 = &min_sched_tunable_scaling, 2991983a922SChristian Ehrhardt .extra2 = &max_sched_tunable_scaling, 3002398f2c6SPeter Zijlstra }, 3012398f2c6SPeter Zijlstra { 302ffda12a1SPeter Zijlstra .procname = "sched_shares_thresh", 303ffda12a1SPeter Zijlstra .data = &sysctl_sched_shares_thresh, 304ffda12a1SPeter Zijlstra .maxlen = sizeof(unsigned int), 305ffda12a1SPeter Zijlstra .mode = 0644, 3066d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 307ffda12a1SPeter Zijlstra .extra1 = &zero, 308ffda12a1SPeter Zijlstra }, 309ffda12a1SPeter Zijlstra { 310da84d961SIngo Molnar .procname = "sched_migration_cost", 311da84d961SIngo Molnar .data = &sysctl_sched_migration_cost, 312da84d961SIngo Molnar .maxlen = sizeof(unsigned int), 313da84d961SIngo Molnar .mode = 0644, 3146d456111SEric W. Biederman .proc_handler = proc_dointvec, 315da84d961SIngo Molnar }, 316b82d9fddSPeter Zijlstra { 317b82d9fddSPeter Zijlstra .procname = "sched_nr_migrate", 318b82d9fddSPeter Zijlstra .data = &sysctl_sched_nr_migrate, 319b82d9fddSPeter Zijlstra .maxlen = sizeof(unsigned int), 320fa85ae24SPeter Zijlstra .mode = 0644, 3216d456111SEric W. Biederman .proc_handler = proc_dointvec, 322fa85ae24SPeter Zijlstra }, 323cd1bb94bSArun R Bharadwaj { 324e9e9250bSPeter Zijlstra .procname = "sched_time_avg", 325e9e9250bSPeter Zijlstra .data = &sysctl_sched_time_avg, 326e9e9250bSPeter Zijlstra .maxlen = sizeof(unsigned int), 327e9e9250bSPeter Zijlstra .mode = 0644, 3286d456111SEric W. Biederman .proc_handler = proc_dointvec, 329e9e9250bSPeter Zijlstra }, 330e9e9250bSPeter Zijlstra { 331cd1bb94bSArun R Bharadwaj .procname = "timer_migration", 332cd1bb94bSArun R Bharadwaj .data = &sysctl_timer_migration, 333cd1bb94bSArun R Bharadwaj .maxlen = sizeof(unsigned int), 334cd1bb94bSArun R Bharadwaj .mode = 0644, 3356d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 336bfdb4d9fSArun R Bharadwaj .extra1 = &zero, 337bfdb4d9fSArun R Bharadwaj .extra2 = &one, 338cd1bb94bSArun R Bharadwaj }, 3391fc84aaaSPeter Zijlstra #endif 3401799e35dSIngo Molnar { 3419f0c1e56SPeter Zijlstra .procname = "sched_rt_period_us", 3429f0c1e56SPeter Zijlstra .data = &sysctl_sched_rt_period, 3439f0c1e56SPeter Zijlstra .maxlen = sizeof(unsigned int), 3449f0c1e56SPeter Zijlstra .mode = 0644, 3456d456111SEric W. Biederman .proc_handler = sched_rt_handler, 3469f0c1e56SPeter Zijlstra }, 3479f0c1e56SPeter Zijlstra { 3489f0c1e56SPeter Zijlstra .procname = "sched_rt_runtime_us", 3499f0c1e56SPeter Zijlstra .data = &sysctl_sched_rt_runtime, 3509f0c1e56SPeter Zijlstra .maxlen = sizeof(int), 3519f0c1e56SPeter Zijlstra .mode = 0644, 3526d456111SEric W. Biederman .proc_handler = sched_rt_handler, 3539f0c1e56SPeter Zijlstra }, 3549f0c1e56SPeter Zijlstra { 3551799e35dSIngo Molnar .procname = "sched_compat_yield", 3561799e35dSIngo Molnar .data = &sysctl_sched_compat_yield, 3571799e35dSIngo Molnar .maxlen = sizeof(unsigned int), 3581799e35dSIngo Molnar .mode = 0644, 3596d456111SEric W. Biederman .proc_handler = proc_dointvec, 3601799e35dSIngo Molnar }, 361f20786ffSPeter Zijlstra #ifdef CONFIG_PROVE_LOCKING 362f20786ffSPeter Zijlstra { 363f20786ffSPeter Zijlstra .procname = "prove_locking", 364f20786ffSPeter Zijlstra .data = &prove_locking, 365f20786ffSPeter Zijlstra .maxlen = sizeof(int), 366f20786ffSPeter Zijlstra .mode = 0644, 3676d456111SEric W. Biederman .proc_handler = proc_dointvec, 368f20786ffSPeter Zijlstra }, 369f20786ffSPeter Zijlstra #endif 370f20786ffSPeter Zijlstra #ifdef CONFIG_LOCK_STAT 371f20786ffSPeter Zijlstra { 372f20786ffSPeter Zijlstra .procname = "lock_stat", 373f20786ffSPeter Zijlstra .data = &lock_stat, 374f20786ffSPeter Zijlstra .maxlen = sizeof(int), 375f20786ffSPeter Zijlstra .mode = 0644, 3766d456111SEric W. Biederman .proc_handler = proc_dointvec, 377f20786ffSPeter Zijlstra }, 378f20786ffSPeter Zijlstra #endif 37977e54a1fSIngo Molnar { 3801da177e4SLinus Torvalds .procname = "panic", 3811da177e4SLinus Torvalds .data = &panic_timeout, 3821da177e4SLinus Torvalds .maxlen = sizeof(int), 3831da177e4SLinus Torvalds .mode = 0644, 3846d456111SEric W. Biederman .proc_handler = proc_dointvec, 3851da177e4SLinus Torvalds }, 3861da177e4SLinus Torvalds { 3871da177e4SLinus Torvalds .procname = "core_uses_pid", 3881da177e4SLinus Torvalds .data = &core_uses_pid, 3891da177e4SLinus Torvalds .maxlen = sizeof(int), 3901da177e4SLinus Torvalds .mode = 0644, 3916d456111SEric W. Biederman .proc_handler = proc_dointvec, 3921da177e4SLinus Torvalds }, 3931da177e4SLinus Torvalds { 3941da177e4SLinus Torvalds .procname = "core_pattern", 3951da177e4SLinus Torvalds .data = core_pattern, 39671ce92f3SDan Aloni .maxlen = CORENAME_MAX_SIZE, 3971da177e4SLinus Torvalds .mode = 0644, 3986d456111SEric W. Biederman .proc_handler = proc_dostring, 3991da177e4SLinus Torvalds }, 400a293980cSNeil Horman { 401a293980cSNeil Horman .procname = "core_pipe_limit", 402a293980cSNeil Horman .data = &core_pipe_limit, 403a293980cSNeil Horman .maxlen = sizeof(unsigned int), 404a293980cSNeil Horman .mode = 0644, 4056d456111SEric W. Biederman .proc_handler = proc_dointvec, 406a293980cSNeil Horman }, 40734f5a398STheodore Ts'o #ifdef CONFIG_PROC_SYSCTL 4081da177e4SLinus Torvalds { 4091da177e4SLinus Torvalds .procname = "tainted", 41025ddbb18SAndi Kleen .maxlen = sizeof(long), 41134f5a398STheodore Ts'o .mode = 0644, 4126d456111SEric W. Biederman .proc_handler = proc_taint, 4131da177e4SLinus Torvalds }, 41434f5a398STheodore Ts'o #endif 4159745512cSArjan van de Ven #ifdef CONFIG_LATENCYTOP 4169745512cSArjan van de Ven { 4179745512cSArjan van de Ven .procname = "latencytop", 4189745512cSArjan van de Ven .data = &latencytop_enabled, 4199745512cSArjan van de Ven .maxlen = sizeof(int), 4209745512cSArjan van de Ven .mode = 0644, 4216d456111SEric W. Biederman .proc_handler = proc_dointvec, 4229745512cSArjan van de Ven }, 4239745512cSArjan van de Ven #endif 4241da177e4SLinus Torvalds #ifdef CONFIG_BLK_DEV_INITRD 4251da177e4SLinus Torvalds { 4261da177e4SLinus Torvalds .procname = "real-root-dev", 4271da177e4SLinus Torvalds .data = &real_root_dev, 4281da177e4SLinus Torvalds .maxlen = sizeof(int), 4291da177e4SLinus Torvalds .mode = 0644, 4306d456111SEric W. Biederman .proc_handler = proc_dointvec, 4311da177e4SLinus Torvalds }, 4321da177e4SLinus Torvalds #endif 43345807a1dSIngo Molnar { 43445807a1dSIngo Molnar .procname = "print-fatal-signals", 43545807a1dSIngo Molnar .data = &print_fatal_signals, 43645807a1dSIngo Molnar .maxlen = sizeof(int), 43745807a1dSIngo Molnar .mode = 0644, 4386d456111SEric W. Biederman .proc_handler = proc_dointvec, 43945807a1dSIngo Molnar }, 44072c57ed5SDavid S. Miller #ifdef CONFIG_SPARC 4411da177e4SLinus Torvalds { 4421da177e4SLinus Torvalds .procname = "reboot-cmd", 4431da177e4SLinus Torvalds .data = reboot_command, 4441da177e4SLinus Torvalds .maxlen = 256, 4451da177e4SLinus Torvalds .mode = 0644, 4466d456111SEric W. Biederman .proc_handler = proc_dostring, 4471da177e4SLinus Torvalds }, 4481da177e4SLinus Torvalds { 4491da177e4SLinus Torvalds .procname = "stop-a", 4501da177e4SLinus Torvalds .data = &stop_a_enabled, 4511da177e4SLinus Torvalds .maxlen = sizeof (int), 4521da177e4SLinus Torvalds .mode = 0644, 4536d456111SEric W. Biederman .proc_handler = proc_dointvec, 4541da177e4SLinus Torvalds }, 4551da177e4SLinus Torvalds { 4561da177e4SLinus Torvalds .procname = "scons-poweroff", 4571da177e4SLinus Torvalds .data = &scons_pwroff, 4581da177e4SLinus Torvalds .maxlen = sizeof (int), 4591da177e4SLinus Torvalds .mode = 0644, 4606d456111SEric W. Biederman .proc_handler = proc_dointvec, 4611da177e4SLinus Torvalds }, 4621da177e4SLinus Torvalds #endif 4630871420fSDavid S. Miller #ifdef CONFIG_SPARC64 4640871420fSDavid S. Miller { 4650871420fSDavid S. Miller .procname = "tsb-ratio", 4660871420fSDavid S. Miller .data = &sysctl_tsb_ratio, 4670871420fSDavid S. Miller .maxlen = sizeof (int), 4680871420fSDavid S. Miller .mode = 0644, 4696d456111SEric W. Biederman .proc_handler = proc_dointvec, 4700871420fSDavid S. Miller }, 4710871420fSDavid S. Miller #endif 4721da177e4SLinus Torvalds #ifdef __hppa__ 4731da177e4SLinus Torvalds { 4741da177e4SLinus Torvalds .procname = "soft-power", 4751da177e4SLinus Torvalds .data = &pwrsw_enabled, 4761da177e4SLinus Torvalds .maxlen = sizeof (int), 4771da177e4SLinus Torvalds .mode = 0644, 4786d456111SEric W. Biederman .proc_handler = proc_dointvec, 4791da177e4SLinus Torvalds }, 4801da177e4SLinus Torvalds { 4811da177e4SLinus Torvalds .procname = "unaligned-trap", 4821da177e4SLinus Torvalds .data = &unaligned_enabled, 4831da177e4SLinus Torvalds .maxlen = sizeof (int), 4841da177e4SLinus Torvalds .mode = 0644, 4856d456111SEric W. Biederman .proc_handler = proc_dointvec, 4861da177e4SLinus Torvalds }, 4871da177e4SLinus Torvalds #endif 4881da177e4SLinus Torvalds { 4891da177e4SLinus Torvalds .procname = "ctrl-alt-del", 4901da177e4SLinus Torvalds .data = &C_A_D, 4911da177e4SLinus Torvalds .maxlen = sizeof(int), 4921da177e4SLinus Torvalds .mode = 0644, 4936d456111SEric W. Biederman .proc_handler = proc_dointvec, 4941da177e4SLinus Torvalds }, 495606576ceSSteven Rostedt #ifdef CONFIG_FUNCTION_TRACER 496b0fc494fSSteven Rostedt { 497b0fc494fSSteven Rostedt .procname = "ftrace_enabled", 498b0fc494fSSteven Rostedt .data = &ftrace_enabled, 499b0fc494fSSteven Rostedt .maxlen = sizeof(int), 500b0fc494fSSteven Rostedt .mode = 0644, 5016d456111SEric W. Biederman .proc_handler = ftrace_enable_sysctl, 502b0fc494fSSteven Rostedt }, 503b0fc494fSSteven Rostedt #endif 504f38f1d2aSSteven Rostedt #ifdef CONFIG_STACK_TRACER 505f38f1d2aSSteven Rostedt { 506f38f1d2aSSteven Rostedt .procname = "stack_tracer_enabled", 507f38f1d2aSSteven Rostedt .data = &stack_tracer_enabled, 508f38f1d2aSSteven Rostedt .maxlen = sizeof(int), 509f38f1d2aSSteven Rostedt .mode = 0644, 5106d456111SEric W. Biederman .proc_handler = stack_trace_sysctl, 511f38f1d2aSSteven Rostedt }, 512f38f1d2aSSteven Rostedt #endif 513944ac425SSteven Rostedt #ifdef CONFIG_TRACING 514944ac425SSteven Rostedt { 5153299b4ddSPeter Zijlstra .procname = "ftrace_dump_on_oops", 516944ac425SSteven Rostedt .data = &ftrace_dump_on_oops, 517944ac425SSteven Rostedt .maxlen = sizeof(int), 518944ac425SSteven Rostedt .mode = 0644, 5196d456111SEric W. Biederman .proc_handler = proc_dointvec, 520944ac425SSteven Rostedt }, 521944ac425SSteven Rostedt #endif 522a1ef5adbSJohannes Berg #ifdef CONFIG_MODULES 5231da177e4SLinus Torvalds { 5241da177e4SLinus Torvalds .procname = "modprobe", 5251da177e4SLinus Torvalds .data = &modprobe_path, 5261da177e4SLinus Torvalds .maxlen = KMOD_PATH_LEN, 5271da177e4SLinus Torvalds .mode = 0644, 5286d456111SEric W. Biederman .proc_handler = proc_dostring, 5291da177e4SLinus Torvalds }, 5303d43321bSKees Cook { 5313d43321bSKees Cook .procname = "modules_disabled", 5323d43321bSKees Cook .data = &modules_disabled, 5333d43321bSKees Cook .maxlen = sizeof(int), 5343d43321bSKees Cook .mode = 0644, 5353d43321bSKees Cook /* only handle a transition from default "0" to "1" */ 5366d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 5373d43321bSKees Cook .extra1 = &one, 5383d43321bSKees Cook .extra2 = &one, 5393d43321bSKees Cook }, 5401da177e4SLinus Torvalds #endif 54157ae2508SAndrew Morton #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 5421da177e4SLinus Torvalds { 5431da177e4SLinus Torvalds .procname = "hotplug", 544312c004dSKay Sievers .data = &uevent_helper, 545312c004dSKay Sievers .maxlen = UEVENT_HELPER_PATH_LEN, 5461da177e4SLinus Torvalds .mode = 0644, 5476d456111SEric W. Biederman .proc_handler = proc_dostring, 5481da177e4SLinus Torvalds }, 5491da177e4SLinus Torvalds #endif 5501da177e4SLinus Torvalds #ifdef CONFIG_CHR_DEV_SG 5511da177e4SLinus Torvalds { 5521da177e4SLinus Torvalds .procname = "sg-big-buff", 5531da177e4SLinus Torvalds .data = &sg_big_buff, 5541da177e4SLinus Torvalds .maxlen = sizeof (int), 5551da177e4SLinus Torvalds .mode = 0444, 5566d456111SEric W. Biederman .proc_handler = proc_dointvec, 5571da177e4SLinus Torvalds }, 5581da177e4SLinus Torvalds #endif 5591da177e4SLinus Torvalds #ifdef CONFIG_BSD_PROCESS_ACCT 5601da177e4SLinus Torvalds { 5611da177e4SLinus Torvalds .procname = "acct", 5621da177e4SLinus Torvalds .data = &acct_parm, 5631da177e4SLinus Torvalds .maxlen = 3*sizeof(int), 5641da177e4SLinus Torvalds .mode = 0644, 5656d456111SEric W. Biederman .proc_handler = proc_dointvec, 5661da177e4SLinus Torvalds }, 5671da177e4SLinus Torvalds #endif 5681da177e4SLinus Torvalds #ifdef CONFIG_MAGIC_SYSRQ 5691da177e4SLinus Torvalds { 5701da177e4SLinus Torvalds .procname = "sysrq", 5715d6f647fSIngo Molnar .data = &__sysrq_enabled, 5721da177e4SLinus Torvalds .maxlen = sizeof (int), 5731da177e4SLinus Torvalds .mode = 0644, 5746d456111SEric W. Biederman .proc_handler = proc_dointvec, 5751da177e4SLinus Torvalds }, 5761da177e4SLinus Torvalds #endif 577d6f8ff73SRandy Dunlap #ifdef CONFIG_PROC_SYSCTL 5781da177e4SLinus Torvalds { 5791da177e4SLinus Torvalds .procname = "cad_pid", 5809ec52099SCedric Le Goater .data = NULL, 5811da177e4SLinus Torvalds .maxlen = sizeof (int), 5821da177e4SLinus Torvalds .mode = 0600, 5836d456111SEric W. Biederman .proc_handler = proc_do_cad_pid, 5841da177e4SLinus Torvalds }, 585d6f8ff73SRandy Dunlap #endif 5861da177e4SLinus Torvalds { 5871da177e4SLinus Torvalds .procname = "threads-max", 5881da177e4SLinus Torvalds .data = &max_threads, 5891da177e4SLinus Torvalds .maxlen = sizeof(int), 5901da177e4SLinus Torvalds .mode = 0644, 5916d456111SEric W. Biederman .proc_handler = proc_dointvec, 5921da177e4SLinus Torvalds }, 5931da177e4SLinus Torvalds { 5941da177e4SLinus Torvalds .procname = "random", 5951da177e4SLinus Torvalds .mode = 0555, 5961da177e4SLinus Torvalds .child = random_table, 5971da177e4SLinus Torvalds }, 5981da177e4SLinus Torvalds { 5991da177e4SLinus Torvalds .procname = "overflowuid", 6001da177e4SLinus Torvalds .data = &overflowuid, 6011da177e4SLinus Torvalds .maxlen = sizeof(int), 6021da177e4SLinus Torvalds .mode = 0644, 6036d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6041da177e4SLinus Torvalds .extra1 = &minolduid, 6051da177e4SLinus Torvalds .extra2 = &maxolduid, 6061da177e4SLinus Torvalds }, 6071da177e4SLinus Torvalds { 6081da177e4SLinus Torvalds .procname = "overflowgid", 6091da177e4SLinus Torvalds .data = &overflowgid, 6101da177e4SLinus Torvalds .maxlen = sizeof(int), 6111da177e4SLinus Torvalds .mode = 0644, 6126d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6131da177e4SLinus Torvalds .extra1 = &minolduid, 6141da177e4SLinus Torvalds .extra2 = &maxolduid, 6151da177e4SLinus Torvalds }, 616347a8dc3SMartin Schwidefsky #ifdef CONFIG_S390 6171da177e4SLinus Torvalds #ifdef CONFIG_MATHEMU 6181da177e4SLinus Torvalds { 6191da177e4SLinus Torvalds .procname = "ieee_emulation_warnings", 6201da177e4SLinus Torvalds .data = &sysctl_ieee_emulation_warnings, 6211da177e4SLinus Torvalds .maxlen = sizeof(int), 6221da177e4SLinus Torvalds .mode = 0644, 6236d456111SEric W. Biederman .proc_handler = proc_dointvec, 6241da177e4SLinus Torvalds }, 6251da177e4SLinus Torvalds #endif 6261da177e4SLinus Torvalds { 6271da177e4SLinus Torvalds .procname = "userprocess_debug", 6281da177e4SLinus Torvalds .data = &sysctl_userprocess_debug, 6291da177e4SLinus Torvalds .maxlen = sizeof(int), 6301da177e4SLinus Torvalds .mode = 0644, 6316d456111SEric W. Biederman .proc_handler = proc_dointvec, 6321da177e4SLinus Torvalds }, 6331da177e4SLinus Torvalds #endif 6341da177e4SLinus Torvalds { 6351da177e4SLinus Torvalds .procname = "pid_max", 6361da177e4SLinus Torvalds .data = &pid_max, 6371da177e4SLinus Torvalds .maxlen = sizeof (int), 6381da177e4SLinus Torvalds .mode = 0644, 6396d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6401da177e4SLinus Torvalds .extra1 = &pid_max_min, 6411da177e4SLinus Torvalds .extra2 = &pid_max_max, 6421da177e4SLinus Torvalds }, 6431da177e4SLinus Torvalds { 6441da177e4SLinus Torvalds .procname = "panic_on_oops", 6451da177e4SLinus Torvalds .data = &panic_on_oops, 6461da177e4SLinus Torvalds .maxlen = sizeof(int), 6471da177e4SLinus Torvalds .mode = 0644, 6486d456111SEric W. Biederman .proc_handler = proc_dointvec, 6491da177e4SLinus Torvalds }, 6507ef3d2fdSJoe Perches #if defined CONFIG_PRINTK 6517ef3d2fdSJoe Perches { 6527ef3d2fdSJoe Perches .procname = "printk", 6537ef3d2fdSJoe Perches .data = &console_loglevel, 6547ef3d2fdSJoe Perches .maxlen = 4*sizeof(int), 6557ef3d2fdSJoe Perches .mode = 0644, 6566d456111SEric W. Biederman .proc_handler = proc_dointvec, 6577ef3d2fdSJoe Perches }, 6581da177e4SLinus Torvalds { 6591da177e4SLinus Torvalds .procname = "printk_ratelimit", 660717115e1SDave Young .data = &printk_ratelimit_state.interval, 6611da177e4SLinus Torvalds .maxlen = sizeof(int), 6621da177e4SLinus Torvalds .mode = 0644, 6636d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 6641da177e4SLinus Torvalds }, 6651da177e4SLinus Torvalds { 6661da177e4SLinus Torvalds .procname = "printk_ratelimit_burst", 667717115e1SDave Young .data = &printk_ratelimit_state.burst, 6681da177e4SLinus Torvalds .maxlen = sizeof(int), 6691da177e4SLinus Torvalds .mode = 0644, 6706d456111SEric W. Biederman .proc_handler = proc_dointvec, 6711da177e4SLinus Torvalds }, 672af91322eSDave Young { 673af91322eSDave Young .procname = "printk_delay", 674af91322eSDave Young .data = &printk_delay_msec, 675af91322eSDave Young .maxlen = sizeof(int), 676af91322eSDave Young .mode = 0644, 6776d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 678af91322eSDave Young .extra1 = &zero, 679af91322eSDave Young .extra2 = &ten_thousand, 680af91322eSDave Young }, 6817ef3d2fdSJoe Perches #endif 6821da177e4SLinus Torvalds { 6831da177e4SLinus Torvalds .procname = "ngroups_max", 6841da177e4SLinus Torvalds .data = &ngroups_max, 6851da177e4SLinus Torvalds .maxlen = sizeof (int), 6861da177e4SLinus Torvalds .mode = 0444, 6876d456111SEric W. Biederman .proc_handler = proc_dointvec, 6881da177e4SLinus Torvalds }, 689*58687acbSDon Zickus #if defined(CONFIG_LOCKUP_DETECTOR) 690504d7cf1SDon Zickus { 691*58687acbSDon Zickus .procname = "watchdog", 692*58687acbSDon Zickus .data = &watchdog_enabled, 693504d7cf1SDon Zickus .maxlen = sizeof (int), 694504d7cf1SDon Zickus .mode = 0644, 695*58687acbSDon Zickus .proc_handler = proc_dowatchdog_enabled, 696*58687acbSDon Zickus }, 697*58687acbSDon Zickus { 698*58687acbSDon Zickus .procname = "watchdog_thresh", 699*58687acbSDon Zickus .data = &softlockup_thresh, 700*58687acbSDon Zickus .maxlen = sizeof(int), 701*58687acbSDon Zickus .mode = 0644, 702*58687acbSDon Zickus .proc_handler = proc_dowatchdog_thresh, 703*58687acbSDon Zickus .extra1 = &neg_one, 704*58687acbSDon Zickus .extra2 = &sixty, 705504d7cf1SDon Zickus }, 706504d7cf1SDon Zickus #endif 707*58687acbSDon Zickus #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) && !defined(CONFIG_LOCKUP_DETECTOR) 7081da177e4SLinus Torvalds { 7091da177e4SLinus Torvalds .procname = "unknown_nmi_panic", 7101da177e4SLinus Torvalds .data = &unknown_nmi_panic, 7111da177e4SLinus Torvalds .maxlen = sizeof (int), 7121da177e4SLinus Torvalds .mode = 0644, 7136d456111SEric W. Biederman .proc_handler = proc_dointvec, 7141da177e4SLinus Torvalds }, 715407984f1SDon Zickus { 716407984f1SDon Zickus .procname = "nmi_watchdog", 717407984f1SDon Zickus .data = &nmi_watchdog_enabled, 718407984f1SDon Zickus .maxlen = sizeof (int), 719407984f1SDon Zickus .mode = 0644, 7206d456111SEric W. Biederman .proc_handler = proc_nmi_enabled, 7211da177e4SLinus Torvalds }, 7221da177e4SLinus Torvalds #endif 7231da177e4SLinus Torvalds #if defined(CONFIG_X86) 7241da177e4SLinus Torvalds { 7258da5addaSDon Zickus .procname = "panic_on_unrecovered_nmi", 7268da5addaSDon Zickus .data = &panic_on_unrecovered_nmi, 7278da5addaSDon Zickus .maxlen = sizeof(int), 7288da5addaSDon Zickus .mode = 0644, 7296d456111SEric W. Biederman .proc_handler = proc_dointvec, 7308da5addaSDon Zickus }, 7318da5addaSDon Zickus { 7325211a242SKurt Garloff .procname = "panic_on_io_nmi", 7335211a242SKurt Garloff .data = &panic_on_io_nmi, 7345211a242SKurt Garloff .maxlen = sizeof(int), 7355211a242SKurt Garloff .mode = 0644, 7366d456111SEric W. Biederman .proc_handler = proc_dointvec, 7375211a242SKurt Garloff }, 7385211a242SKurt Garloff { 7391da177e4SLinus Torvalds .procname = "bootloader_type", 7401da177e4SLinus Torvalds .data = &bootloader_type, 7411da177e4SLinus Torvalds .maxlen = sizeof (int), 7421da177e4SLinus Torvalds .mode = 0444, 7436d456111SEric W. Biederman .proc_handler = proc_dointvec, 7441da177e4SLinus Torvalds }, 7450741f4d2SChuck Ebbert { 7465031296cSH. Peter Anvin .procname = "bootloader_version", 7475031296cSH. Peter Anvin .data = &bootloader_version, 7485031296cSH. Peter Anvin .maxlen = sizeof (int), 7495031296cSH. Peter Anvin .mode = 0444, 7506d456111SEric W. Biederman .proc_handler = proc_dointvec, 7515031296cSH. Peter Anvin }, 7525031296cSH. Peter Anvin { 7530741f4d2SChuck Ebbert .procname = "kstack_depth_to_print", 7540741f4d2SChuck Ebbert .data = &kstack_depth_to_print, 7550741f4d2SChuck Ebbert .maxlen = sizeof(int), 7560741f4d2SChuck Ebbert .mode = 0644, 7576d456111SEric W. Biederman .proc_handler = proc_dointvec, 7580741f4d2SChuck Ebbert }, 7596e7c4025SIngo Molnar { 7606e7c4025SIngo Molnar .procname = "io_delay_type", 7616e7c4025SIngo Molnar .data = &io_delay_type, 7626e7c4025SIngo Molnar .maxlen = sizeof(int), 7636e7c4025SIngo Molnar .mode = 0644, 7646d456111SEric W. Biederman .proc_handler = proc_dointvec, 7656e7c4025SIngo Molnar }, 7661da177e4SLinus Torvalds #endif 7677a9166e3SLuke Yang #if defined(CONFIG_MMU) 7681da177e4SLinus Torvalds { 7691da177e4SLinus Torvalds .procname = "randomize_va_space", 7701da177e4SLinus Torvalds .data = &randomize_va_space, 7711da177e4SLinus Torvalds .maxlen = sizeof(int), 7721da177e4SLinus Torvalds .mode = 0644, 7736d456111SEric W. Biederman .proc_handler = proc_dointvec, 7741da177e4SLinus Torvalds }, 7757a9166e3SLuke Yang #endif 7760152fb37SMartin Schwidefsky #if defined(CONFIG_S390) && defined(CONFIG_SMP) 777951f22d5SMartin Schwidefsky { 778951f22d5SMartin Schwidefsky .procname = "spin_retry", 779951f22d5SMartin Schwidefsky .data = &spin_retry, 780951f22d5SMartin Schwidefsky .maxlen = sizeof (int), 781951f22d5SMartin Schwidefsky .mode = 0644, 7826d456111SEric W. Biederman .proc_handler = proc_dointvec, 783951f22d5SMartin Schwidefsky }, 784951f22d5SMartin Schwidefsky #endif 785673d5b43SLen Brown #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 786c255d844SPavel Machek { 787c255d844SPavel Machek .procname = "acpi_video_flags", 78877afcf78SPavel Machek .data = &acpi_realmode_flags, 789c255d844SPavel Machek .maxlen = sizeof (unsigned long), 790c255d844SPavel Machek .mode = 0644, 7916d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 792c255d844SPavel Machek }, 793c255d844SPavel Machek #endif 794d2b176edSJes Sorensen #ifdef CONFIG_IA64 795d2b176edSJes Sorensen { 796d2b176edSJes Sorensen .procname = "ignore-unaligned-usertrap", 797d2b176edSJes Sorensen .data = &no_unaligned_warning, 798d2b176edSJes Sorensen .maxlen = sizeof (int), 799d2b176edSJes Sorensen .mode = 0644, 8006d456111SEric W. Biederman .proc_handler = proc_dointvec, 801d2b176edSJes Sorensen }, 80288fc241fSDoug Chapman { 80388fc241fSDoug Chapman .procname = "unaligned-dump-stack", 80488fc241fSDoug Chapman .data = &unaligned_dump_stack, 80588fc241fSDoug Chapman .maxlen = sizeof (int), 80688fc241fSDoug Chapman .mode = 0644, 8076d456111SEric W. Biederman .proc_handler = proc_dointvec, 80888fc241fSDoug Chapman }, 809d2b176edSJes Sorensen #endif 810c4f3b63fSRavikiran G Thirumalai #ifdef CONFIG_DETECT_SOFTLOCKUP 811c4f3b63fSRavikiran G Thirumalai { 8129c44bc03SIngo Molnar .procname = "softlockup_panic", 8139c44bc03SIngo Molnar .data = &softlockup_panic, 8149c44bc03SIngo Molnar .maxlen = sizeof(int), 8159c44bc03SIngo Molnar .mode = 0644, 8166d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 8179c44bc03SIngo Molnar .extra1 = &zero, 8189c44bc03SIngo Molnar .extra2 = &one, 8199c44bc03SIngo Molnar }, 8209c44bc03SIngo Molnar { 821c4f3b63fSRavikiran G Thirumalai .procname = "softlockup_thresh", 822c4f3b63fSRavikiran G Thirumalai .data = &softlockup_thresh, 8239383d967SDimitri Sivanich .maxlen = sizeof(int), 824c4f3b63fSRavikiran G Thirumalai .mode = 0644, 8256d456111SEric W. Biederman .proc_handler = proc_dosoftlockup_thresh, 8269383d967SDimitri Sivanich .extra1 = &neg_one, 827c4f3b63fSRavikiran G Thirumalai .extra2 = &sixty, 828c4f3b63fSRavikiran G Thirumalai }, 829e162b39aSMandeep Singh Baines #endif 830e162b39aSMandeep Singh Baines #ifdef CONFIG_DETECT_HUNG_TASK 831e162b39aSMandeep Singh Baines { 832e162b39aSMandeep Singh Baines .procname = "hung_task_panic", 833e162b39aSMandeep Singh Baines .data = &sysctl_hung_task_panic, 834e162b39aSMandeep Singh Baines .maxlen = sizeof(int), 835e162b39aSMandeep Singh Baines .mode = 0644, 8366d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 837e162b39aSMandeep Singh Baines .extra1 = &zero, 838e162b39aSMandeep Singh Baines .extra2 = &one, 839e162b39aSMandeep Singh Baines }, 84082a1fcb9SIngo Molnar { 84182a1fcb9SIngo Molnar .procname = "hung_task_check_count", 84282a1fcb9SIngo Molnar .data = &sysctl_hung_task_check_count, 84390739081SIngo Molnar .maxlen = sizeof(unsigned long), 84482a1fcb9SIngo Molnar .mode = 0644, 8456d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 84682a1fcb9SIngo Molnar }, 84782a1fcb9SIngo Molnar { 84882a1fcb9SIngo Molnar .procname = "hung_task_timeout_secs", 84982a1fcb9SIngo Molnar .data = &sysctl_hung_task_timeout_secs, 85090739081SIngo Molnar .maxlen = sizeof(unsigned long), 85182a1fcb9SIngo Molnar .mode = 0644, 8526d456111SEric W. Biederman .proc_handler = proc_dohung_task_timeout_secs, 85382a1fcb9SIngo Molnar }, 85482a1fcb9SIngo Molnar { 85582a1fcb9SIngo Molnar .procname = "hung_task_warnings", 85682a1fcb9SIngo Molnar .data = &sysctl_hung_task_warnings, 85790739081SIngo Molnar .maxlen = sizeof(unsigned long), 85882a1fcb9SIngo Molnar .mode = 0644, 8596d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 86082a1fcb9SIngo Molnar }, 861c4f3b63fSRavikiran G Thirumalai #endif 862bebfa101SAndi Kleen #ifdef CONFIG_COMPAT 863bebfa101SAndi Kleen { 864bebfa101SAndi Kleen .procname = "compat-log", 865bebfa101SAndi Kleen .data = &compat_log, 866bebfa101SAndi Kleen .maxlen = sizeof (int), 867bebfa101SAndi Kleen .mode = 0644, 8686d456111SEric W. Biederman .proc_handler = proc_dointvec, 869bebfa101SAndi Kleen }, 870bebfa101SAndi Kleen #endif 87123f78d4aSIngo Molnar #ifdef CONFIG_RT_MUTEXES 87223f78d4aSIngo Molnar { 87323f78d4aSIngo Molnar .procname = "max_lock_depth", 87423f78d4aSIngo Molnar .data = &max_lock_depth, 87523f78d4aSIngo Molnar .maxlen = sizeof(int), 87623f78d4aSIngo Molnar .mode = 0644, 8776d456111SEric W. Biederman .proc_handler = proc_dointvec, 87823f78d4aSIngo Molnar }, 87923f78d4aSIngo Molnar #endif 88010a0a8d4SJeremy Fitzhardinge { 88110a0a8d4SJeremy Fitzhardinge .procname = "poweroff_cmd", 88210a0a8d4SJeremy Fitzhardinge .data = &poweroff_cmd, 88310a0a8d4SJeremy Fitzhardinge .maxlen = POWEROFF_CMD_PATH_LEN, 88410a0a8d4SJeremy Fitzhardinge .mode = 0644, 8856d456111SEric W. Biederman .proc_handler = proc_dostring, 88610a0a8d4SJeremy Fitzhardinge }, 8870b77f5bfSDavid Howells #ifdef CONFIG_KEYS 8880b77f5bfSDavid Howells { 8890b77f5bfSDavid Howells .procname = "keys", 8900b77f5bfSDavid Howells .mode = 0555, 8910b77f5bfSDavid Howells .child = key_sysctls, 8920b77f5bfSDavid Howells }, 8930b77f5bfSDavid Howells #endif 89431a72bceSPaul E. McKenney #ifdef CONFIG_RCU_TORTURE_TEST 89531a72bceSPaul E. McKenney { 89631a72bceSPaul E. McKenney .procname = "rcutorture_runnable", 89731a72bceSPaul E. McKenney .data = &rcutorture_runnable, 89831a72bceSPaul E. McKenney .maxlen = sizeof(int), 89931a72bceSPaul E. McKenney .mode = 0644, 9006d456111SEric W. Biederman .proc_handler = proc_dointvec, 90131a72bceSPaul E. McKenney }, 90231a72bceSPaul E. McKenney #endif 90312e22c5eSDavid Howells #ifdef CONFIG_SLOW_WORK 90412e22c5eSDavid Howells { 90512e22c5eSDavid Howells .procname = "slow-work", 90612e22c5eSDavid Howells .mode = 0555, 90712e22c5eSDavid Howells .child = slow_work_sysctls, 90812e22c5eSDavid Howells }, 90912e22c5eSDavid Howells #endif 910cdd6c482SIngo Molnar #ifdef CONFIG_PERF_EVENTS 9111ccd1549SPeter Zijlstra { 912cdd6c482SIngo Molnar .procname = "perf_event_paranoid", 913cdd6c482SIngo Molnar .data = &sysctl_perf_event_paranoid, 914cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_paranoid), 9151ccd1549SPeter Zijlstra .mode = 0644, 9166d456111SEric W. Biederman .proc_handler = proc_dointvec, 9171ccd1549SPeter Zijlstra }, 918c5078f78SPeter Zijlstra { 919cdd6c482SIngo Molnar .procname = "perf_event_mlock_kb", 920cdd6c482SIngo Molnar .data = &sysctl_perf_event_mlock, 921cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_mlock), 922c5078f78SPeter Zijlstra .mode = 0644, 9236d456111SEric W. Biederman .proc_handler = proc_dointvec, 924c5078f78SPeter Zijlstra }, 925a78ac325SPeter Zijlstra { 926cdd6c482SIngo Molnar .procname = "perf_event_max_sample_rate", 927cdd6c482SIngo Molnar .data = &sysctl_perf_event_sample_rate, 928cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_sample_rate), 929a78ac325SPeter Zijlstra .mode = 0644, 9306d456111SEric W. Biederman .proc_handler = proc_dointvec, 931a78ac325SPeter Zijlstra }, 9321ccd1549SPeter Zijlstra #endif 933dfec072eSVegard Nossum #ifdef CONFIG_KMEMCHECK 934dfec072eSVegard Nossum { 935dfec072eSVegard Nossum .procname = "kmemcheck", 936dfec072eSVegard Nossum .data = &kmemcheck_enabled, 937dfec072eSVegard Nossum .maxlen = sizeof(int), 938dfec072eSVegard Nossum .mode = 0644, 9396d456111SEric W. Biederman .proc_handler = proc_dointvec, 940dfec072eSVegard Nossum }, 941dfec072eSVegard Nossum #endif 942cb684b5bSJens Axboe #ifdef CONFIG_BLOCK 9435e605b64SJens Axboe { 9445e605b64SJens Axboe .procname = "blk_iopoll", 9455e605b64SJens Axboe .data = &blk_iopoll_enabled, 9465e605b64SJens Axboe .maxlen = sizeof(int), 9475e605b64SJens Axboe .mode = 0644, 9486d456111SEric W. Biederman .proc_handler = proc_dointvec, 9495e605b64SJens Axboe }, 950cb684b5bSJens Axboe #endif 951ed2c12f3SAndrew Morton /* 952ed2c12f3SAndrew Morton * NOTE: do not add new entries to this table unless you have read 953ed2c12f3SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 954ed2c12f3SAndrew Morton */ 9556fce56ecSEric W. Biederman { } 9561da177e4SLinus Torvalds }; 9571da177e4SLinus Torvalds 958d8217f07SEric W. Biederman static struct ctl_table vm_table[] = { 9591da177e4SLinus Torvalds { 9601da177e4SLinus Torvalds .procname = "overcommit_memory", 9611da177e4SLinus Torvalds .data = &sysctl_overcommit_memory, 9621da177e4SLinus Torvalds .maxlen = sizeof(sysctl_overcommit_memory), 9631da177e4SLinus Torvalds .mode = 0644, 9646d456111SEric W. Biederman .proc_handler = proc_dointvec, 9651da177e4SLinus Torvalds }, 9661da177e4SLinus Torvalds { 967fadd8fbdSKAMEZAWA Hiroyuki .procname = "panic_on_oom", 968fadd8fbdSKAMEZAWA Hiroyuki .data = &sysctl_panic_on_oom, 969fadd8fbdSKAMEZAWA Hiroyuki .maxlen = sizeof(sysctl_panic_on_oom), 970fadd8fbdSKAMEZAWA Hiroyuki .mode = 0644, 9716d456111SEric W. Biederman .proc_handler = proc_dointvec, 972fadd8fbdSKAMEZAWA Hiroyuki }, 973fadd8fbdSKAMEZAWA Hiroyuki { 974fe071d7eSDavid Rientjes .procname = "oom_kill_allocating_task", 975fe071d7eSDavid Rientjes .data = &sysctl_oom_kill_allocating_task, 976fe071d7eSDavid Rientjes .maxlen = sizeof(sysctl_oom_kill_allocating_task), 977fe071d7eSDavid Rientjes .mode = 0644, 9786d456111SEric W. Biederman .proc_handler = proc_dointvec, 979fe071d7eSDavid Rientjes }, 980fe071d7eSDavid Rientjes { 981fef1bdd6SDavid Rientjes .procname = "oom_dump_tasks", 982fef1bdd6SDavid Rientjes .data = &sysctl_oom_dump_tasks, 983fef1bdd6SDavid Rientjes .maxlen = sizeof(sysctl_oom_dump_tasks), 984fef1bdd6SDavid Rientjes .mode = 0644, 9856d456111SEric W. Biederman .proc_handler = proc_dointvec, 986fef1bdd6SDavid Rientjes }, 987fef1bdd6SDavid Rientjes { 9881da177e4SLinus Torvalds .procname = "overcommit_ratio", 9891da177e4SLinus Torvalds .data = &sysctl_overcommit_ratio, 9901da177e4SLinus Torvalds .maxlen = sizeof(sysctl_overcommit_ratio), 9911da177e4SLinus Torvalds .mode = 0644, 9926d456111SEric W. Biederman .proc_handler = proc_dointvec, 9931da177e4SLinus Torvalds }, 9941da177e4SLinus Torvalds { 9951da177e4SLinus Torvalds .procname = "page-cluster", 9961da177e4SLinus Torvalds .data = &page_cluster, 9971da177e4SLinus Torvalds .maxlen = sizeof(int), 9981da177e4SLinus Torvalds .mode = 0644, 9996d456111SEric W. Biederman .proc_handler = proc_dointvec, 10001da177e4SLinus Torvalds }, 10011da177e4SLinus Torvalds { 10021da177e4SLinus Torvalds .procname = "dirty_background_ratio", 10031da177e4SLinus Torvalds .data = &dirty_background_ratio, 10041da177e4SLinus Torvalds .maxlen = sizeof(dirty_background_ratio), 10051da177e4SLinus Torvalds .mode = 0644, 10066d456111SEric W. Biederman .proc_handler = dirty_background_ratio_handler, 10071da177e4SLinus Torvalds .extra1 = &zero, 10081da177e4SLinus Torvalds .extra2 = &one_hundred, 10091da177e4SLinus Torvalds }, 10101da177e4SLinus Torvalds { 10112da02997SDavid Rientjes .procname = "dirty_background_bytes", 10122da02997SDavid Rientjes .data = &dirty_background_bytes, 10132da02997SDavid Rientjes .maxlen = sizeof(dirty_background_bytes), 10142da02997SDavid Rientjes .mode = 0644, 10156d456111SEric W. Biederman .proc_handler = dirty_background_bytes_handler, 1016fc3501d4SSven Wegener .extra1 = &one_ul, 10172da02997SDavid Rientjes }, 10182da02997SDavid Rientjes { 10191da177e4SLinus Torvalds .procname = "dirty_ratio", 10201da177e4SLinus Torvalds .data = &vm_dirty_ratio, 10211da177e4SLinus Torvalds .maxlen = sizeof(vm_dirty_ratio), 10221da177e4SLinus Torvalds .mode = 0644, 10236d456111SEric W. Biederman .proc_handler = dirty_ratio_handler, 10241da177e4SLinus Torvalds .extra1 = &zero, 10251da177e4SLinus Torvalds .extra2 = &one_hundred, 10261da177e4SLinus Torvalds }, 10271da177e4SLinus Torvalds { 10282da02997SDavid Rientjes .procname = "dirty_bytes", 10292da02997SDavid Rientjes .data = &vm_dirty_bytes, 10302da02997SDavid Rientjes .maxlen = sizeof(vm_dirty_bytes), 10312da02997SDavid Rientjes .mode = 0644, 10326d456111SEric W. Biederman .proc_handler = dirty_bytes_handler, 10339e4a5bdaSAndrea Righi .extra1 = &dirty_bytes_min, 10342da02997SDavid Rientjes }, 10352da02997SDavid Rientjes { 10361da177e4SLinus Torvalds .procname = "dirty_writeback_centisecs", 1037f6ef9438SBart Samwel .data = &dirty_writeback_interval, 1038f6ef9438SBart Samwel .maxlen = sizeof(dirty_writeback_interval), 10391da177e4SLinus Torvalds .mode = 0644, 10406d456111SEric W. Biederman .proc_handler = dirty_writeback_centisecs_handler, 10411da177e4SLinus Torvalds }, 10421da177e4SLinus Torvalds { 10431da177e4SLinus Torvalds .procname = "dirty_expire_centisecs", 1044f6ef9438SBart Samwel .data = &dirty_expire_interval, 1045f6ef9438SBart Samwel .maxlen = sizeof(dirty_expire_interval), 10461da177e4SLinus Torvalds .mode = 0644, 10476d456111SEric W. Biederman .proc_handler = proc_dointvec, 10481da177e4SLinus Torvalds }, 10491da177e4SLinus Torvalds { 10501da177e4SLinus Torvalds .procname = "nr_pdflush_threads", 10511da177e4SLinus Torvalds .data = &nr_pdflush_threads, 10521da177e4SLinus Torvalds .maxlen = sizeof nr_pdflush_threads, 10531da177e4SLinus Torvalds .mode = 0444 /* read-only*/, 10546d456111SEric W. Biederman .proc_handler = proc_dointvec, 10551da177e4SLinus Torvalds }, 10561da177e4SLinus Torvalds { 10571da177e4SLinus Torvalds .procname = "swappiness", 10581da177e4SLinus Torvalds .data = &vm_swappiness, 10591da177e4SLinus Torvalds .maxlen = sizeof(vm_swappiness), 10601da177e4SLinus Torvalds .mode = 0644, 10616d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 10621da177e4SLinus Torvalds .extra1 = &zero, 10631da177e4SLinus Torvalds .extra2 = &one_hundred, 10641da177e4SLinus Torvalds }, 10651da177e4SLinus Torvalds #ifdef CONFIG_HUGETLB_PAGE 10661da177e4SLinus Torvalds { 10671da177e4SLinus Torvalds .procname = "nr_hugepages", 1068e5ff2159SAndi Kleen .data = NULL, 10691da177e4SLinus Torvalds .maxlen = sizeof(unsigned long), 10701da177e4SLinus Torvalds .mode = 0644, 10716d456111SEric W. Biederman .proc_handler = hugetlb_sysctl_handler, 10721da177e4SLinus Torvalds .extra1 = (void *)&hugetlb_zero, 10731da177e4SLinus Torvalds .extra2 = (void *)&hugetlb_infinity, 10741da177e4SLinus Torvalds }, 107506808b08SLee Schermerhorn #ifdef CONFIG_NUMA 107606808b08SLee Schermerhorn { 107706808b08SLee Schermerhorn .procname = "nr_hugepages_mempolicy", 107806808b08SLee Schermerhorn .data = NULL, 107906808b08SLee Schermerhorn .maxlen = sizeof(unsigned long), 108006808b08SLee Schermerhorn .mode = 0644, 108106808b08SLee Schermerhorn .proc_handler = &hugetlb_mempolicy_sysctl_handler, 108206808b08SLee Schermerhorn .extra1 = (void *)&hugetlb_zero, 108306808b08SLee Schermerhorn .extra2 = (void *)&hugetlb_infinity, 108406808b08SLee Schermerhorn }, 108506808b08SLee Schermerhorn #endif 10861da177e4SLinus Torvalds { 10871da177e4SLinus Torvalds .procname = "hugetlb_shm_group", 10881da177e4SLinus Torvalds .data = &sysctl_hugetlb_shm_group, 10891da177e4SLinus Torvalds .maxlen = sizeof(gid_t), 10901da177e4SLinus Torvalds .mode = 0644, 10916d456111SEric W. Biederman .proc_handler = proc_dointvec, 10921da177e4SLinus Torvalds }, 1093396faf03SMel Gorman { 1094396faf03SMel Gorman .procname = "hugepages_treat_as_movable", 1095396faf03SMel Gorman .data = &hugepages_treat_as_movable, 1096396faf03SMel Gorman .maxlen = sizeof(int), 1097396faf03SMel Gorman .mode = 0644, 10986d456111SEric W. Biederman .proc_handler = hugetlb_treat_movable_handler, 1099396faf03SMel Gorman }, 110054f9f80dSAdam Litke { 1101d1c3fb1fSNishanth Aravamudan .procname = "nr_overcommit_hugepages", 1102e5ff2159SAndi Kleen .data = NULL, 1103e5ff2159SAndi Kleen .maxlen = sizeof(unsigned long), 1104d1c3fb1fSNishanth Aravamudan .mode = 0644, 11056d456111SEric W. Biederman .proc_handler = hugetlb_overcommit_handler, 1106e5ff2159SAndi Kleen .extra1 = (void *)&hugetlb_zero, 1107e5ff2159SAndi Kleen .extra2 = (void *)&hugetlb_infinity, 1108d1c3fb1fSNishanth Aravamudan }, 11091da177e4SLinus Torvalds #endif 11101da177e4SLinus Torvalds { 11111da177e4SLinus Torvalds .procname = "lowmem_reserve_ratio", 11121da177e4SLinus Torvalds .data = &sysctl_lowmem_reserve_ratio, 11131da177e4SLinus Torvalds .maxlen = sizeof(sysctl_lowmem_reserve_ratio), 11141da177e4SLinus Torvalds .mode = 0644, 11156d456111SEric W. Biederman .proc_handler = lowmem_reserve_ratio_sysctl_handler, 11161da177e4SLinus Torvalds }, 11171da177e4SLinus Torvalds { 11189d0243bcSAndrew Morton .procname = "drop_caches", 11199d0243bcSAndrew Morton .data = &sysctl_drop_caches, 11209d0243bcSAndrew Morton .maxlen = sizeof(int), 11219d0243bcSAndrew Morton .mode = 0644, 11229d0243bcSAndrew Morton .proc_handler = drop_caches_sysctl_handler, 11239d0243bcSAndrew Morton }, 11249d0243bcSAndrew Morton { 11251da177e4SLinus Torvalds .procname = "min_free_kbytes", 11261da177e4SLinus Torvalds .data = &min_free_kbytes, 11271da177e4SLinus Torvalds .maxlen = sizeof(min_free_kbytes), 11281da177e4SLinus Torvalds .mode = 0644, 11296d456111SEric W. Biederman .proc_handler = min_free_kbytes_sysctl_handler, 11301da177e4SLinus Torvalds .extra1 = &zero, 11311da177e4SLinus Torvalds }, 11328ad4b1fbSRohit Seth { 11338ad4b1fbSRohit Seth .procname = "percpu_pagelist_fraction", 11348ad4b1fbSRohit Seth .data = &percpu_pagelist_fraction, 11358ad4b1fbSRohit Seth .maxlen = sizeof(percpu_pagelist_fraction), 11368ad4b1fbSRohit Seth .mode = 0644, 11376d456111SEric W. Biederman .proc_handler = percpu_pagelist_fraction_sysctl_handler, 11388ad4b1fbSRohit Seth .extra1 = &min_percpu_pagelist_fract, 11398ad4b1fbSRohit Seth }, 11401da177e4SLinus Torvalds #ifdef CONFIG_MMU 11411da177e4SLinus Torvalds { 11421da177e4SLinus Torvalds .procname = "max_map_count", 11431da177e4SLinus Torvalds .data = &sysctl_max_map_count, 11441da177e4SLinus Torvalds .maxlen = sizeof(sysctl_max_map_count), 11451da177e4SLinus Torvalds .mode = 0644, 11463e26120cSWANG Cong .proc_handler = proc_dointvec_minmax, 114770da2340SAmerigo Wang .extra1 = &zero, 11481da177e4SLinus Torvalds }, 1149dd8632a1SPaul Mundt #else 1150dd8632a1SPaul Mundt { 1151dd8632a1SPaul Mundt .procname = "nr_trim_pages", 1152dd8632a1SPaul Mundt .data = &sysctl_nr_trim_pages, 1153dd8632a1SPaul Mundt .maxlen = sizeof(sysctl_nr_trim_pages), 1154dd8632a1SPaul Mundt .mode = 0644, 11556d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1156dd8632a1SPaul Mundt .extra1 = &zero, 1157dd8632a1SPaul Mundt }, 11581da177e4SLinus Torvalds #endif 11591da177e4SLinus Torvalds { 11601da177e4SLinus Torvalds .procname = "laptop_mode", 11611da177e4SLinus Torvalds .data = &laptop_mode, 11621da177e4SLinus Torvalds .maxlen = sizeof(laptop_mode), 11631da177e4SLinus Torvalds .mode = 0644, 11646d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 11651da177e4SLinus Torvalds }, 11661da177e4SLinus Torvalds { 11671da177e4SLinus Torvalds .procname = "block_dump", 11681da177e4SLinus Torvalds .data = &block_dump, 11691da177e4SLinus Torvalds .maxlen = sizeof(block_dump), 11701da177e4SLinus Torvalds .mode = 0644, 11716d456111SEric W. Biederman .proc_handler = proc_dointvec, 11721da177e4SLinus Torvalds .extra1 = &zero, 11731da177e4SLinus Torvalds }, 11741da177e4SLinus Torvalds { 11751da177e4SLinus Torvalds .procname = "vfs_cache_pressure", 11761da177e4SLinus Torvalds .data = &sysctl_vfs_cache_pressure, 11771da177e4SLinus Torvalds .maxlen = sizeof(sysctl_vfs_cache_pressure), 11781da177e4SLinus Torvalds .mode = 0644, 11796d456111SEric W. Biederman .proc_handler = proc_dointvec, 11801da177e4SLinus Torvalds .extra1 = &zero, 11811da177e4SLinus Torvalds }, 11821da177e4SLinus Torvalds #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 11831da177e4SLinus Torvalds { 11841da177e4SLinus Torvalds .procname = "legacy_va_layout", 11851da177e4SLinus Torvalds .data = &sysctl_legacy_va_layout, 11861da177e4SLinus Torvalds .maxlen = sizeof(sysctl_legacy_va_layout), 11871da177e4SLinus Torvalds .mode = 0644, 11886d456111SEric W. Biederman .proc_handler = proc_dointvec, 11891da177e4SLinus Torvalds .extra1 = &zero, 11901da177e4SLinus Torvalds }, 11911da177e4SLinus Torvalds #endif 11921743660bSChristoph Lameter #ifdef CONFIG_NUMA 11931743660bSChristoph Lameter { 11941743660bSChristoph Lameter .procname = "zone_reclaim_mode", 11951743660bSChristoph Lameter .data = &zone_reclaim_mode, 11961743660bSChristoph Lameter .maxlen = sizeof(zone_reclaim_mode), 11971743660bSChristoph Lameter .mode = 0644, 11986d456111SEric W. Biederman .proc_handler = proc_dointvec, 1199c84db23cSChristoph Lameter .extra1 = &zero, 12001743660bSChristoph Lameter }, 12019614634fSChristoph Lameter { 12029614634fSChristoph Lameter .procname = "min_unmapped_ratio", 12039614634fSChristoph Lameter .data = &sysctl_min_unmapped_ratio, 12049614634fSChristoph Lameter .maxlen = sizeof(sysctl_min_unmapped_ratio), 12059614634fSChristoph Lameter .mode = 0644, 12066d456111SEric W. Biederman .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, 12079614634fSChristoph Lameter .extra1 = &zero, 12089614634fSChristoph Lameter .extra2 = &one_hundred, 12099614634fSChristoph Lameter }, 12100ff38490SChristoph Lameter { 12110ff38490SChristoph Lameter .procname = "min_slab_ratio", 12120ff38490SChristoph Lameter .data = &sysctl_min_slab_ratio, 12130ff38490SChristoph Lameter .maxlen = sizeof(sysctl_min_slab_ratio), 12140ff38490SChristoph Lameter .mode = 0644, 12156d456111SEric W. Biederman .proc_handler = sysctl_min_slab_ratio_sysctl_handler, 12160ff38490SChristoph Lameter .extra1 = &zero, 12170ff38490SChristoph Lameter .extra2 = &one_hundred, 12180ff38490SChristoph Lameter }, 12191743660bSChristoph Lameter #endif 122077461ab3SChristoph Lameter #ifdef CONFIG_SMP 122177461ab3SChristoph Lameter { 122277461ab3SChristoph Lameter .procname = "stat_interval", 122377461ab3SChristoph Lameter .data = &sysctl_stat_interval, 122477461ab3SChristoph Lameter .maxlen = sizeof(sysctl_stat_interval), 122577461ab3SChristoph Lameter .mode = 0644, 12266d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 122777461ab3SChristoph Lameter }, 122877461ab3SChristoph Lameter #endif 12296e141546SDavid Howells #ifdef CONFIG_MMU 1230ed032189SEric Paris { 1231ed032189SEric Paris .procname = "mmap_min_addr", 1232788084abSEric Paris .data = &dac_mmap_min_addr, 1233ed032189SEric Paris .maxlen = sizeof(unsigned long), 1234ed032189SEric Paris .mode = 0644, 12356d456111SEric W. Biederman .proc_handler = mmap_min_addr_handler, 1236ed032189SEric Paris }, 12376e141546SDavid Howells #endif 1238f0c0b2b8SKAMEZAWA Hiroyuki #ifdef CONFIG_NUMA 1239f0c0b2b8SKAMEZAWA Hiroyuki { 1240f0c0b2b8SKAMEZAWA Hiroyuki .procname = "numa_zonelist_order", 1241f0c0b2b8SKAMEZAWA Hiroyuki .data = &numa_zonelist_order, 1242f0c0b2b8SKAMEZAWA Hiroyuki .maxlen = NUMA_ZONELIST_ORDER_LEN, 1243f0c0b2b8SKAMEZAWA Hiroyuki .mode = 0644, 12446d456111SEric W. Biederman .proc_handler = numa_zonelist_order_handler, 1245f0c0b2b8SKAMEZAWA Hiroyuki }, 1246f0c0b2b8SKAMEZAWA Hiroyuki #endif 12472b8232ceSAl Viro #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ 12485c36e657SPaul Mundt (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1249e6e5494cSIngo Molnar { 1250e6e5494cSIngo Molnar .procname = "vdso_enabled", 1251e6e5494cSIngo Molnar .data = &vdso_enabled, 1252e6e5494cSIngo Molnar .maxlen = sizeof(vdso_enabled), 1253e6e5494cSIngo Molnar .mode = 0644, 12546d456111SEric W. Biederman .proc_handler = proc_dointvec, 1255e6e5494cSIngo Molnar .extra1 = &zero, 1256e6e5494cSIngo Molnar }, 1257e6e5494cSIngo Molnar #endif 1258195cf453SBron Gondwana #ifdef CONFIG_HIGHMEM 1259195cf453SBron Gondwana { 1260195cf453SBron Gondwana .procname = "highmem_is_dirtyable", 1261195cf453SBron Gondwana .data = &vm_highmem_is_dirtyable, 1262195cf453SBron Gondwana .maxlen = sizeof(vm_highmem_is_dirtyable), 1263195cf453SBron Gondwana .mode = 0644, 12646d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1265195cf453SBron Gondwana .extra1 = &zero, 1266195cf453SBron Gondwana .extra2 = &one, 1267195cf453SBron Gondwana }, 1268195cf453SBron Gondwana #endif 12694be6f6bbSPeter Zijlstra { 12704be6f6bbSPeter Zijlstra .procname = "scan_unevictable_pages", 12714be6f6bbSPeter Zijlstra .data = &scan_unevictable_pages, 12724be6f6bbSPeter Zijlstra .maxlen = sizeof(scan_unevictable_pages), 12734be6f6bbSPeter Zijlstra .mode = 0644, 12746d456111SEric W. Biederman .proc_handler = scan_unevictable_handler, 12754be6f6bbSPeter Zijlstra }, 12766a46079cSAndi Kleen #ifdef CONFIG_MEMORY_FAILURE 12776a46079cSAndi Kleen { 12786a46079cSAndi Kleen .procname = "memory_failure_early_kill", 12796a46079cSAndi Kleen .data = &sysctl_memory_failure_early_kill, 12806a46079cSAndi Kleen .maxlen = sizeof(sysctl_memory_failure_early_kill), 12816a46079cSAndi Kleen .mode = 0644, 12826d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 12836a46079cSAndi Kleen .extra1 = &zero, 12846a46079cSAndi Kleen .extra2 = &one, 12856a46079cSAndi Kleen }, 12866a46079cSAndi Kleen { 12876a46079cSAndi Kleen .procname = "memory_failure_recovery", 12886a46079cSAndi Kleen .data = &sysctl_memory_failure_recovery, 12896a46079cSAndi Kleen .maxlen = sizeof(sysctl_memory_failure_recovery), 12906a46079cSAndi Kleen .mode = 0644, 12916d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 12926a46079cSAndi Kleen .extra1 = &zero, 12936a46079cSAndi Kleen .extra2 = &one, 12946a46079cSAndi Kleen }, 12956a46079cSAndi Kleen #endif 12966a46079cSAndi Kleen 12972be7fe07SAndrew Morton /* 12982be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 12992be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 13002be7fe07SAndrew Morton */ 13016fce56ecSEric W. Biederman { } 13021da177e4SLinus Torvalds }; 13031da177e4SLinus Torvalds 13042abc26fcSEric W. Biederman #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1305d8217f07SEric W. Biederman static struct ctl_table binfmt_misc_table[] = { 13066fce56ecSEric W. Biederman { } 13072abc26fcSEric W. Biederman }; 13082abc26fcSEric W. Biederman #endif 13092abc26fcSEric W. Biederman 1310d8217f07SEric W. Biederman static struct ctl_table fs_table[] = { 13111da177e4SLinus Torvalds { 13121da177e4SLinus Torvalds .procname = "inode-nr", 13131da177e4SLinus Torvalds .data = &inodes_stat, 13141da177e4SLinus Torvalds .maxlen = 2*sizeof(int), 13151da177e4SLinus Torvalds .mode = 0444, 13166d456111SEric W. Biederman .proc_handler = proc_dointvec, 13171da177e4SLinus Torvalds }, 13181da177e4SLinus Torvalds { 13191da177e4SLinus Torvalds .procname = "inode-state", 13201da177e4SLinus Torvalds .data = &inodes_stat, 13211da177e4SLinus Torvalds .maxlen = 7*sizeof(int), 13221da177e4SLinus Torvalds .mode = 0444, 13236d456111SEric W. Biederman .proc_handler = proc_dointvec, 13241da177e4SLinus Torvalds }, 13251da177e4SLinus Torvalds { 13261da177e4SLinus Torvalds .procname = "file-nr", 13271da177e4SLinus Torvalds .data = &files_stat, 13281da177e4SLinus Torvalds .maxlen = 3*sizeof(int), 13291da177e4SLinus Torvalds .mode = 0444, 13306d456111SEric W. Biederman .proc_handler = proc_nr_files, 13311da177e4SLinus Torvalds }, 13321da177e4SLinus Torvalds { 13331da177e4SLinus Torvalds .procname = "file-max", 13341da177e4SLinus Torvalds .data = &files_stat.max_files, 13351da177e4SLinus Torvalds .maxlen = sizeof(int), 13361da177e4SLinus Torvalds .mode = 0644, 13376d456111SEric W. Biederman .proc_handler = proc_dointvec, 13381da177e4SLinus Torvalds }, 13391da177e4SLinus Torvalds { 13409cfe015aSEric Dumazet .procname = "nr_open", 13419cfe015aSEric Dumazet .data = &sysctl_nr_open, 13429cfe015aSEric Dumazet .maxlen = sizeof(int), 13439cfe015aSEric Dumazet .mode = 0644, 13446d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1345eceea0b3SAl Viro .extra1 = &sysctl_nr_open_min, 1346eceea0b3SAl Viro .extra2 = &sysctl_nr_open_max, 13479cfe015aSEric Dumazet }, 13489cfe015aSEric Dumazet { 13491da177e4SLinus Torvalds .procname = "dentry-state", 13501da177e4SLinus Torvalds .data = &dentry_stat, 13511da177e4SLinus Torvalds .maxlen = 6*sizeof(int), 13521da177e4SLinus Torvalds .mode = 0444, 13536d456111SEric W. Biederman .proc_handler = proc_dointvec, 13541da177e4SLinus Torvalds }, 13551da177e4SLinus Torvalds { 13561da177e4SLinus Torvalds .procname = "overflowuid", 13571da177e4SLinus Torvalds .data = &fs_overflowuid, 13581da177e4SLinus Torvalds .maxlen = sizeof(int), 13591da177e4SLinus Torvalds .mode = 0644, 13606d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 13611da177e4SLinus Torvalds .extra1 = &minolduid, 13621da177e4SLinus Torvalds .extra2 = &maxolduid, 13631da177e4SLinus Torvalds }, 13641da177e4SLinus Torvalds { 13651da177e4SLinus Torvalds .procname = "overflowgid", 13661da177e4SLinus Torvalds .data = &fs_overflowgid, 13671da177e4SLinus Torvalds .maxlen = sizeof(int), 13681da177e4SLinus Torvalds .mode = 0644, 13696d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 13701da177e4SLinus Torvalds .extra1 = &minolduid, 13711da177e4SLinus Torvalds .extra2 = &maxolduid, 13721da177e4SLinus Torvalds }, 1373bfcd17a6SThomas Petazzoni #ifdef CONFIG_FILE_LOCKING 13741da177e4SLinus Torvalds { 13751da177e4SLinus Torvalds .procname = "leases-enable", 13761da177e4SLinus Torvalds .data = &leases_enable, 13771da177e4SLinus Torvalds .maxlen = sizeof(int), 13781da177e4SLinus Torvalds .mode = 0644, 13796d456111SEric W. Biederman .proc_handler = proc_dointvec, 13801da177e4SLinus Torvalds }, 1381bfcd17a6SThomas Petazzoni #endif 13821da177e4SLinus Torvalds #ifdef CONFIG_DNOTIFY 13831da177e4SLinus Torvalds { 13841da177e4SLinus Torvalds .procname = "dir-notify-enable", 13851da177e4SLinus Torvalds .data = &dir_notify_enable, 13861da177e4SLinus Torvalds .maxlen = sizeof(int), 13871da177e4SLinus Torvalds .mode = 0644, 13886d456111SEric W. Biederman .proc_handler = proc_dointvec, 13891da177e4SLinus Torvalds }, 13901da177e4SLinus Torvalds #endif 13911da177e4SLinus Torvalds #ifdef CONFIG_MMU 1392bfcd17a6SThomas Petazzoni #ifdef CONFIG_FILE_LOCKING 13931da177e4SLinus Torvalds { 13941da177e4SLinus Torvalds .procname = "lease-break-time", 13951da177e4SLinus Torvalds .data = &lease_break_time, 13961da177e4SLinus Torvalds .maxlen = sizeof(int), 13971da177e4SLinus Torvalds .mode = 0644, 13986d456111SEric W. Biederman .proc_handler = proc_dointvec, 13991da177e4SLinus Torvalds }, 1400bfcd17a6SThomas Petazzoni #endif 1401ebf3f09cSThomas Petazzoni #ifdef CONFIG_AIO 14021da177e4SLinus Torvalds { 14031da177e4SLinus Torvalds .procname = "aio-nr", 14041da177e4SLinus Torvalds .data = &aio_nr, 14051da177e4SLinus Torvalds .maxlen = sizeof(aio_nr), 14061da177e4SLinus Torvalds .mode = 0444, 14076d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 14081da177e4SLinus Torvalds }, 14091da177e4SLinus Torvalds { 14101da177e4SLinus Torvalds .procname = "aio-max-nr", 14111da177e4SLinus Torvalds .data = &aio_max_nr, 14121da177e4SLinus Torvalds .maxlen = sizeof(aio_max_nr), 14131da177e4SLinus Torvalds .mode = 0644, 14146d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 14151da177e4SLinus Torvalds }, 1416ebf3f09cSThomas Petazzoni #endif /* CONFIG_AIO */ 14172d9048e2SAmy Griffis #ifdef CONFIG_INOTIFY_USER 14180399cb08SRobert Love { 14190399cb08SRobert Love .procname = "inotify", 14200399cb08SRobert Love .mode = 0555, 14210399cb08SRobert Love .child = inotify_table, 14220399cb08SRobert Love }, 14230399cb08SRobert Love #endif 14247ef9964eSDavide Libenzi #ifdef CONFIG_EPOLL 14257ef9964eSDavide Libenzi { 14267ef9964eSDavide Libenzi .procname = "epoll", 14277ef9964eSDavide Libenzi .mode = 0555, 14287ef9964eSDavide Libenzi .child = epoll_table, 14297ef9964eSDavide Libenzi }, 14307ef9964eSDavide Libenzi #endif 14311da177e4SLinus Torvalds #endif 1432d6e71144SAlan Cox { 1433d6e71144SAlan Cox .procname = "suid_dumpable", 1434d6e71144SAlan Cox .data = &suid_dumpable, 1435d6e71144SAlan Cox .maxlen = sizeof(int), 1436d6e71144SAlan Cox .mode = 0644, 14376d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 14388e654fbaSMatthew Wilcox .extra1 = &zero, 14398e654fbaSMatthew Wilcox .extra2 = &two, 1440d6e71144SAlan Cox }, 14412abc26fcSEric W. Biederman #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 14422abc26fcSEric W. Biederman { 14432abc26fcSEric W. Biederman .procname = "binfmt_misc", 14442abc26fcSEric W. Biederman .mode = 0555, 14452abc26fcSEric W. Biederman .child = binfmt_misc_table, 14462abc26fcSEric W. Biederman }, 14472abc26fcSEric W. Biederman #endif 14482be7fe07SAndrew Morton /* 14492be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 14502be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 14512be7fe07SAndrew Morton */ 14526fce56ecSEric W. Biederman { } 14531da177e4SLinus Torvalds }; 14541da177e4SLinus Torvalds 1455d8217f07SEric W. Biederman static struct ctl_table debug_table[] = { 14564b177647SDavid S. Miller #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) 1457abd4f750SMasoud Asgharifard Sharbiani { 1458abd4f750SMasoud Asgharifard Sharbiani .procname = "exception-trace", 1459abd4f750SMasoud Asgharifard Sharbiani .data = &show_unhandled_signals, 1460abd4f750SMasoud Asgharifard Sharbiani .maxlen = sizeof(int), 1461abd4f750SMasoud Asgharifard Sharbiani .mode = 0644, 1462abd4f750SMasoud Asgharifard Sharbiani .proc_handler = proc_dointvec 1463abd4f750SMasoud Asgharifard Sharbiani }, 1464abd4f750SMasoud Asgharifard Sharbiani #endif 1465b2be84dfSMasami Hiramatsu #if defined(CONFIG_OPTPROBES) 1466b2be84dfSMasami Hiramatsu { 1467b2be84dfSMasami Hiramatsu .procname = "kprobes-optimization", 1468b2be84dfSMasami Hiramatsu .data = &sysctl_kprobes_optimization, 1469b2be84dfSMasami Hiramatsu .maxlen = sizeof(int), 1470b2be84dfSMasami Hiramatsu .mode = 0644, 1471b2be84dfSMasami Hiramatsu .proc_handler = proc_kprobes_optimization_handler, 1472b2be84dfSMasami Hiramatsu .extra1 = &zero, 1473b2be84dfSMasami Hiramatsu .extra2 = &one, 1474b2be84dfSMasami Hiramatsu }, 1475b2be84dfSMasami Hiramatsu #endif 14766fce56ecSEric W. Biederman { } 14771da177e4SLinus Torvalds }; 14781da177e4SLinus Torvalds 1479d8217f07SEric W. Biederman static struct ctl_table dev_table[] = { 14806fce56ecSEric W. Biederman { } 14811da177e4SLinus Torvalds }; 14821da177e4SLinus Torvalds 1483330d57fbSAl Viro static DEFINE_SPINLOCK(sysctl_lock); 1484330d57fbSAl Viro 1485330d57fbSAl Viro /* called under sysctl_lock */ 1486330d57fbSAl Viro static int use_table(struct ctl_table_header *p) 1487330d57fbSAl Viro { 1488330d57fbSAl Viro if (unlikely(p->unregistering)) 1489330d57fbSAl Viro return 0; 1490330d57fbSAl Viro p->used++; 1491330d57fbSAl Viro return 1; 1492330d57fbSAl Viro } 1493330d57fbSAl Viro 1494330d57fbSAl Viro /* called under sysctl_lock */ 1495330d57fbSAl Viro static void unuse_table(struct ctl_table_header *p) 1496330d57fbSAl Viro { 1497330d57fbSAl Viro if (!--p->used) 1498330d57fbSAl Viro if (unlikely(p->unregistering)) 1499330d57fbSAl Viro complete(p->unregistering); 1500330d57fbSAl Viro } 1501330d57fbSAl Viro 1502330d57fbSAl Viro /* called under sysctl_lock, will reacquire if has to wait */ 1503330d57fbSAl Viro static void start_unregistering(struct ctl_table_header *p) 1504330d57fbSAl Viro { 1505330d57fbSAl Viro /* 1506330d57fbSAl Viro * if p->used is 0, nobody will ever touch that entry again; 1507330d57fbSAl Viro * we'll eliminate all paths to it before dropping sysctl_lock 1508330d57fbSAl Viro */ 1509330d57fbSAl Viro if (unlikely(p->used)) { 1510330d57fbSAl Viro struct completion wait; 1511330d57fbSAl Viro init_completion(&wait); 1512330d57fbSAl Viro p->unregistering = &wait; 1513330d57fbSAl Viro spin_unlock(&sysctl_lock); 1514330d57fbSAl Viro wait_for_completion(&wait); 1515330d57fbSAl Viro spin_lock(&sysctl_lock); 1516f7e6ced4SAl Viro } else { 1517f7e6ced4SAl Viro /* anything non-NULL; we'll never dereference it */ 1518f7e6ced4SAl Viro p->unregistering = ERR_PTR(-EINVAL); 1519330d57fbSAl Viro } 1520330d57fbSAl Viro /* 1521330d57fbSAl Viro * do not remove from the list until nobody holds it; walking the 1522330d57fbSAl Viro * list in do_sysctl() relies on that. 1523330d57fbSAl Viro */ 1524330d57fbSAl Viro list_del_init(&p->ctl_entry); 1525330d57fbSAl Viro } 1526330d57fbSAl Viro 1527f7e6ced4SAl Viro void sysctl_head_get(struct ctl_table_header *head) 1528f7e6ced4SAl Viro { 1529f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1530f7e6ced4SAl Viro head->count++; 1531f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1532f7e6ced4SAl Viro } 1533f7e6ced4SAl Viro 1534f7e6ced4SAl Viro void sysctl_head_put(struct ctl_table_header *head) 1535f7e6ced4SAl Viro { 1536f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1537f7e6ced4SAl Viro if (!--head->count) 1538f7e6ced4SAl Viro kfree(head); 1539f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1540f7e6ced4SAl Viro } 1541f7e6ced4SAl Viro 1542f7e6ced4SAl Viro struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 1543f7e6ced4SAl Viro { 1544f7e6ced4SAl Viro if (!head) 1545f7e6ced4SAl Viro BUG(); 1546f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1547f7e6ced4SAl Viro if (!use_table(head)) 1548f7e6ced4SAl Viro head = ERR_PTR(-ENOENT); 1549f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1550f7e6ced4SAl Viro return head; 1551f7e6ced4SAl Viro } 1552f7e6ced4SAl Viro 1553805b5d5eSEric W. Biederman void sysctl_head_finish(struct ctl_table_header *head) 1554805b5d5eSEric W. Biederman { 1555805b5d5eSEric W. Biederman if (!head) 1556805b5d5eSEric W. Biederman return; 1557805b5d5eSEric W. Biederman spin_lock(&sysctl_lock); 1558805b5d5eSEric W. Biederman unuse_table(head); 1559805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1560805b5d5eSEric W. Biederman } 1561805b5d5eSEric W. Biederman 156273455092SAl Viro static struct ctl_table_set * 156373455092SAl Viro lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces) 156473455092SAl Viro { 156573455092SAl Viro struct ctl_table_set *set = &root->default_set; 156673455092SAl Viro if (root->lookup) 156773455092SAl Viro set = root->lookup(root, namespaces); 156873455092SAl Viro return set; 156973455092SAl Viro } 157073455092SAl Viro 1571e51b6ba0SEric W. Biederman static struct list_head * 1572e51b6ba0SEric W. Biederman lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces) 1573805b5d5eSEric W. Biederman { 157473455092SAl Viro struct ctl_table_set *set = lookup_header_set(root, namespaces); 157573455092SAl Viro return &set->list; 1576e51b6ba0SEric W. Biederman } 1577e51b6ba0SEric W. Biederman 1578e51b6ba0SEric W. Biederman struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 1579e51b6ba0SEric W. Biederman struct ctl_table_header *prev) 1580e51b6ba0SEric W. Biederman { 1581e51b6ba0SEric W. Biederman struct ctl_table_root *root; 1582e51b6ba0SEric W. Biederman struct list_head *header_list; 1583805b5d5eSEric W. Biederman struct ctl_table_header *head; 1584805b5d5eSEric W. Biederman struct list_head *tmp; 1585e51b6ba0SEric W. Biederman 1586805b5d5eSEric W. Biederman spin_lock(&sysctl_lock); 1587805b5d5eSEric W. Biederman if (prev) { 1588e51b6ba0SEric W. Biederman head = prev; 1589805b5d5eSEric W. Biederman tmp = &prev->ctl_entry; 1590805b5d5eSEric W. Biederman unuse_table(prev); 1591805b5d5eSEric W. Biederman goto next; 1592805b5d5eSEric W. Biederman } 1593805b5d5eSEric W. Biederman tmp = &root_table_header.ctl_entry; 1594805b5d5eSEric W. Biederman for (;;) { 1595805b5d5eSEric W. Biederman head = list_entry(tmp, struct ctl_table_header, ctl_entry); 1596805b5d5eSEric W. Biederman 1597805b5d5eSEric W. Biederman if (!use_table(head)) 1598805b5d5eSEric W. Biederman goto next; 1599805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1600805b5d5eSEric W. Biederman return head; 1601805b5d5eSEric W. Biederman next: 1602e51b6ba0SEric W. Biederman root = head->root; 1603805b5d5eSEric W. Biederman tmp = tmp->next; 1604e51b6ba0SEric W. Biederman header_list = lookup_header_list(root, namespaces); 1605e51b6ba0SEric W. Biederman if (tmp != header_list) 1606e51b6ba0SEric W. Biederman continue; 1607e51b6ba0SEric W. Biederman 1608e51b6ba0SEric W. Biederman do { 1609e51b6ba0SEric W. Biederman root = list_entry(root->root_list.next, 1610e51b6ba0SEric W. Biederman struct ctl_table_root, root_list); 1611e51b6ba0SEric W. Biederman if (root == &sysctl_table_root) 1612e51b6ba0SEric W. Biederman goto out; 1613e51b6ba0SEric W. Biederman header_list = lookup_header_list(root, namespaces); 1614e51b6ba0SEric W. Biederman } while (list_empty(header_list)); 1615e51b6ba0SEric W. Biederman tmp = header_list->next; 1616805b5d5eSEric W. Biederman } 1617e51b6ba0SEric W. Biederman out: 1618805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1619805b5d5eSEric W. Biederman return NULL; 1620805b5d5eSEric W. Biederman } 1621805b5d5eSEric W. Biederman 1622e51b6ba0SEric W. Biederman struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev) 1623e51b6ba0SEric W. Biederman { 1624e51b6ba0SEric W. Biederman return __sysctl_head_next(current->nsproxy, prev); 1625e51b6ba0SEric W. Biederman } 1626e51b6ba0SEric W. Biederman 1627e51b6ba0SEric W. Biederman void register_sysctl_root(struct ctl_table_root *root) 1628e51b6ba0SEric W. Biederman { 1629e51b6ba0SEric W. Biederman spin_lock(&sysctl_lock); 1630e51b6ba0SEric W. Biederman list_add_tail(&root->root_list, &sysctl_table_root.root_list); 1631e51b6ba0SEric W. Biederman spin_unlock(&sysctl_lock); 1632e51b6ba0SEric W. Biederman } 1633e51b6ba0SEric W. Biederman 16341da177e4SLinus Torvalds /* 16351ff007ebSEric W. Biederman * sysctl_perm does NOT grant the superuser all rights automatically, because 16361da177e4SLinus Torvalds * some sysctl variables are readonly even to root. 16371da177e4SLinus Torvalds */ 16381da177e4SLinus Torvalds 16391da177e4SLinus Torvalds static int test_perm(int mode, int op) 16401da177e4SLinus Torvalds { 164176aac0e9SDavid Howells if (!current_euid()) 16421da177e4SLinus Torvalds mode >>= 6; 16431da177e4SLinus Torvalds else if (in_egroup_p(0)) 16441da177e4SLinus Torvalds mode >>= 3; 1645e6305c43SAl Viro if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0) 16461da177e4SLinus Torvalds return 0; 16471da177e4SLinus Torvalds return -EACCES; 16481da177e4SLinus Torvalds } 16491da177e4SLinus Torvalds 1650d7321cd6SPavel Emelyanov int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) 16511da177e4SLinus Torvalds { 16521da177e4SLinus Torvalds int error; 1653d7321cd6SPavel Emelyanov int mode; 1654d7321cd6SPavel Emelyanov 1655e6305c43SAl Viro error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC)); 16561da177e4SLinus Torvalds if (error) 16571da177e4SLinus Torvalds return error; 1658d7321cd6SPavel Emelyanov 1659d7321cd6SPavel Emelyanov if (root->permissions) 1660d7321cd6SPavel Emelyanov mode = root->permissions(root, current->nsproxy, table); 1661d7321cd6SPavel Emelyanov else 1662d7321cd6SPavel Emelyanov mode = table->mode; 1663d7321cd6SPavel Emelyanov 1664d7321cd6SPavel Emelyanov return test_perm(mode, op); 16651da177e4SLinus Torvalds } 16661da177e4SLinus Torvalds 1667d912b0ccSEric W. Biederman static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1668d912b0ccSEric W. Biederman { 16692315ffa0SEric W. Biederman for (; table->procname; table++) { 1670d912b0ccSEric W. Biederman table->parent = parent; 1671d912b0ccSEric W. Biederman if (table->child) 1672d912b0ccSEric W. Biederman sysctl_set_parent(table, table->child); 1673d912b0ccSEric W. Biederman } 1674d912b0ccSEric W. Biederman } 1675d912b0ccSEric W. Biederman 1676d912b0ccSEric W. Biederman static __init int sysctl_init(void) 1677d912b0ccSEric W. Biederman { 1678d912b0ccSEric W. Biederman sysctl_set_parent(NULL, root_table); 167988f458e4SHolger Schurig #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 168088f458e4SHolger Schurig { 168188f458e4SHolger Schurig int err; 1682e51b6ba0SEric W. Biederman err = sysctl_check_table(current->nsproxy, root_table); 168388f458e4SHolger Schurig } 168488f458e4SHolger Schurig #endif 1685d912b0ccSEric W. Biederman return 0; 1686d912b0ccSEric W. Biederman } 1687d912b0ccSEric W. Biederman 1688d912b0ccSEric W. Biederman core_initcall(sysctl_init); 1689d912b0ccSEric W. Biederman 1690bfbcf034SAl Viro static struct ctl_table *is_branch_in(struct ctl_table *branch, 1691bfbcf034SAl Viro struct ctl_table *table) 1692ae7edeccSAl Viro { 1693ae7edeccSAl Viro struct ctl_table *p; 1694ae7edeccSAl Viro const char *s = branch->procname; 1695ae7edeccSAl Viro 1696ae7edeccSAl Viro /* branch should have named subdirectory as its first element */ 1697ae7edeccSAl Viro if (!s || !branch->child) 1698bfbcf034SAl Viro return NULL; 1699ae7edeccSAl Viro 1700ae7edeccSAl Viro /* ... and nothing else */ 17012315ffa0SEric W. Biederman if (branch[1].procname) 1702bfbcf034SAl Viro return NULL; 1703ae7edeccSAl Viro 1704ae7edeccSAl Viro /* table should contain subdirectory with the same name */ 17052315ffa0SEric W. Biederman for (p = table; p->procname; p++) { 1706ae7edeccSAl Viro if (!p->child) 1707ae7edeccSAl Viro continue; 1708ae7edeccSAl Viro if (p->procname && strcmp(p->procname, s) == 0) 1709bfbcf034SAl Viro return p; 1710ae7edeccSAl Viro } 1711bfbcf034SAl Viro return NULL; 1712ae7edeccSAl Viro } 1713ae7edeccSAl Viro 1714ae7edeccSAl Viro /* see if attaching q to p would be an improvement */ 1715ae7edeccSAl Viro static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) 1716ae7edeccSAl Viro { 1717ae7edeccSAl Viro struct ctl_table *to = p->ctl_table, *by = q->ctl_table; 1718bfbcf034SAl Viro struct ctl_table *next; 1719ae7edeccSAl Viro int is_better = 0; 1720ae7edeccSAl Viro int not_in_parent = !p->attached_by; 1721ae7edeccSAl Viro 1722bfbcf034SAl Viro while ((next = is_branch_in(by, to)) != NULL) { 1723ae7edeccSAl Viro if (by == q->attached_by) 1724ae7edeccSAl Viro is_better = 1; 1725ae7edeccSAl Viro if (to == p->attached_by) 1726ae7edeccSAl Viro not_in_parent = 1; 1727ae7edeccSAl Viro by = by->child; 1728bfbcf034SAl Viro to = next->child; 1729ae7edeccSAl Viro } 1730ae7edeccSAl Viro 1731ae7edeccSAl Viro if (is_better && not_in_parent) { 1732ae7edeccSAl Viro q->attached_by = by; 1733ae7edeccSAl Viro q->attached_to = to; 1734ae7edeccSAl Viro q->parent = p; 1735ae7edeccSAl Viro } 1736ae7edeccSAl Viro } 1737ae7edeccSAl Viro 17381da177e4SLinus Torvalds /** 1739e51b6ba0SEric W. Biederman * __register_sysctl_paths - register a sysctl hierarchy 1740e51b6ba0SEric W. Biederman * @root: List of sysctl headers to register on 1741e51b6ba0SEric W. Biederman * @namespaces: Data to compute which lists of sysctl entries are visible 174229e796fdSEric W. Biederman * @path: The path to the directory the sysctl table is in. 17431da177e4SLinus Torvalds * @table: the top-level table structure 17441da177e4SLinus Torvalds * 17451da177e4SLinus Torvalds * Register a sysctl table hierarchy. @table should be a filled in ctl_table 174629e796fdSEric W. Biederman * array. A completely 0 filled entry terminates the table. 17471da177e4SLinus Torvalds * 1748d8217f07SEric W. Biederman * The members of the &struct ctl_table structure are used as follows: 17491da177e4SLinus Torvalds * 17501da177e4SLinus Torvalds * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not 17511da177e4SLinus Torvalds * enter a sysctl file 17521da177e4SLinus Torvalds * 17531da177e4SLinus Torvalds * data - a pointer to data for use by proc_handler 17541da177e4SLinus Torvalds * 17551da177e4SLinus Torvalds * maxlen - the maximum size in bytes of the data 17561da177e4SLinus Torvalds * 17571da177e4SLinus Torvalds * mode - the file permissions for the /proc/sys file, and for sysctl(2) 17581da177e4SLinus Torvalds * 17591da177e4SLinus Torvalds * child - a pointer to the child sysctl table if this entry is a directory, or 17601da177e4SLinus Torvalds * %NULL. 17611da177e4SLinus Torvalds * 17621da177e4SLinus Torvalds * proc_handler - the text handler routine (described below) 17631da177e4SLinus Torvalds * 17641da177e4SLinus Torvalds * de - for internal use by the sysctl routines 17651da177e4SLinus Torvalds * 17661da177e4SLinus Torvalds * extra1, extra2 - extra pointers usable by the proc handler routines 17671da177e4SLinus Torvalds * 17681da177e4SLinus Torvalds * Leaf nodes in the sysctl tree will be represented by a single file 17691da177e4SLinus Torvalds * under /proc; non-leaf nodes will be represented by directories. 17701da177e4SLinus Torvalds * 17711da177e4SLinus Torvalds * sysctl(2) can automatically manage read and write requests through 17721da177e4SLinus Torvalds * the sysctl table. The data and maxlen fields of the ctl_table 17731da177e4SLinus Torvalds * struct enable minimal validation of the values being written to be 17741da177e4SLinus Torvalds * performed, and the mode field allows minimal authentication. 17751da177e4SLinus Torvalds * 17761da177e4SLinus Torvalds * There must be a proc_handler routine for any terminal nodes 17771da177e4SLinus Torvalds * mirrored under /proc/sys (non-terminals are handled by a built-in 17781da177e4SLinus Torvalds * directory handler). Several default handlers are available to 17791da177e4SLinus Torvalds * cover common cases - 17801da177e4SLinus Torvalds * 17811da177e4SLinus Torvalds * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(), 17821da177e4SLinus Torvalds * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(), 17831da177e4SLinus Torvalds * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax() 17841da177e4SLinus Torvalds * 17851da177e4SLinus Torvalds * It is the handler's job to read the input buffer from user memory 17861da177e4SLinus Torvalds * and process it. The handler should return 0 on success. 17871da177e4SLinus Torvalds * 17881da177e4SLinus Torvalds * This routine returns %NULL on a failure to register, and a pointer 17891da177e4SLinus Torvalds * to the table header on success. 17901da177e4SLinus Torvalds */ 1791e51b6ba0SEric W. Biederman struct ctl_table_header *__register_sysctl_paths( 1792e51b6ba0SEric W. Biederman struct ctl_table_root *root, 1793e51b6ba0SEric W. Biederman struct nsproxy *namespaces, 1794e51b6ba0SEric W. Biederman const struct ctl_path *path, struct ctl_table *table) 17951da177e4SLinus Torvalds { 179629e796fdSEric W. Biederman struct ctl_table_header *header; 179729e796fdSEric W. Biederman struct ctl_table *new, **prevp; 179829e796fdSEric W. Biederman unsigned int n, npath; 1799ae7edeccSAl Viro struct ctl_table_set *set; 180029e796fdSEric W. Biederman 180129e796fdSEric W. Biederman /* Count the path components */ 18022315ffa0SEric W. Biederman for (npath = 0; path[npath].procname; ++npath) 180329e796fdSEric W. Biederman ; 180429e796fdSEric W. Biederman 180529e796fdSEric W. Biederman /* 180629e796fdSEric W. Biederman * For each path component, allocate a 2-element ctl_table array. 180729e796fdSEric W. Biederman * The first array element will be filled with the sysctl entry 18082315ffa0SEric W. Biederman * for this, the second will be the sentinel (procname == 0). 180929e796fdSEric W. Biederman * 181029e796fdSEric W. Biederman * We allocate everything in one go so that we don't have to 181129e796fdSEric W. Biederman * worry about freeing additional memory in unregister_sysctl_table. 181229e796fdSEric W. Biederman */ 181329e796fdSEric W. Biederman header = kzalloc(sizeof(struct ctl_table_header) + 181429e796fdSEric W. Biederman (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL); 181529e796fdSEric W. Biederman if (!header) 18161da177e4SLinus Torvalds return NULL; 181729e796fdSEric W. Biederman 181829e796fdSEric W. Biederman new = (struct ctl_table *) (header + 1); 181929e796fdSEric W. Biederman 182029e796fdSEric W. Biederman /* Now connect the dots */ 182129e796fdSEric W. Biederman prevp = &header->ctl_table; 182229e796fdSEric W. Biederman for (n = 0; n < npath; ++n, ++path) { 182329e796fdSEric W. Biederman /* Copy the procname */ 182429e796fdSEric W. Biederman new->procname = path->procname; 182529e796fdSEric W. Biederman new->mode = 0555; 182629e796fdSEric W. Biederman 182729e796fdSEric W. Biederman *prevp = new; 182829e796fdSEric W. Biederman prevp = &new->child; 182929e796fdSEric W. Biederman 183029e796fdSEric W. Biederman new += 2; 183129e796fdSEric W. Biederman } 183229e796fdSEric W. Biederman *prevp = table; 183323eb06deSEric W. Biederman header->ctl_table_arg = table; 183429e796fdSEric W. Biederman 183529e796fdSEric W. Biederman INIT_LIST_HEAD(&header->ctl_entry); 183629e796fdSEric W. Biederman header->used = 0; 183729e796fdSEric W. Biederman header->unregistering = NULL; 1838e51b6ba0SEric W. Biederman header->root = root; 183929e796fdSEric W. Biederman sysctl_set_parent(NULL, header->ctl_table); 1840f7e6ced4SAl Viro header->count = 1; 184188f458e4SHolger Schurig #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 1842e51b6ba0SEric W. Biederman if (sysctl_check_table(namespaces, header->ctl_table)) { 184329e796fdSEric W. Biederman kfree(header); 1844fc6cd25bSEric W. Biederman return NULL; 1845fc6cd25bSEric W. Biederman } 184688f458e4SHolger Schurig #endif 1847330d57fbSAl Viro spin_lock(&sysctl_lock); 184873455092SAl Viro header->set = lookup_header_set(root, namespaces); 1849ae7edeccSAl Viro header->attached_by = header->ctl_table; 1850ae7edeccSAl Viro header->attached_to = root_table; 1851ae7edeccSAl Viro header->parent = &root_table_header; 1852ae7edeccSAl Viro for (set = header->set; set; set = set->parent) { 1853ae7edeccSAl Viro struct ctl_table_header *p; 1854ae7edeccSAl Viro list_for_each_entry(p, &set->list, ctl_entry) { 1855ae7edeccSAl Viro if (p->unregistering) 1856ae7edeccSAl Viro continue; 1857ae7edeccSAl Viro try_attach(p, header); 1858ae7edeccSAl Viro } 1859ae7edeccSAl Viro } 1860ae7edeccSAl Viro header->parent->count++; 186173455092SAl Viro list_add_tail(&header->ctl_entry, &header->set->list); 1862330d57fbSAl Viro spin_unlock(&sysctl_lock); 186329e796fdSEric W. Biederman 186429e796fdSEric W. Biederman return header; 186529e796fdSEric W. Biederman } 186629e796fdSEric W. Biederman 186729e796fdSEric W. Biederman /** 1868e51b6ba0SEric W. Biederman * register_sysctl_table_path - register a sysctl table hierarchy 1869e51b6ba0SEric W. Biederman * @path: The path to the directory the sysctl table is in. 1870e51b6ba0SEric W. Biederman * @table: the top-level table structure 1871e51b6ba0SEric W. Biederman * 1872e51b6ba0SEric W. Biederman * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1873e51b6ba0SEric W. Biederman * array. A completely 0 filled entry terminates the table. 1874e51b6ba0SEric W. Biederman * 1875e51b6ba0SEric W. Biederman * See __register_sysctl_paths for more details. 1876e51b6ba0SEric W. Biederman */ 1877e51b6ba0SEric W. Biederman struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1878e51b6ba0SEric W. Biederman struct ctl_table *table) 1879e51b6ba0SEric W. Biederman { 1880e51b6ba0SEric W. Biederman return __register_sysctl_paths(&sysctl_table_root, current->nsproxy, 1881e51b6ba0SEric W. Biederman path, table); 1882e51b6ba0SEric W. Biederman } 1883e51b6ba0SEric W. Biederman 1884e51b6ba0SEric W. Biederman /** 188529e796fdSEric W. Biederman * register_sysctl_table - register a sysctl table hierarchy 188629e796fdSEric W. Biederman * @table: the top-level table structure 188729e796fdSEric W. Biederman * 188829e796fdSEric W. Biederman * Register a sysctl table hierarchy. @table should be a filled in ctl_table 188929e796fdSEric W. Biederman * array. A completely 0 filled entry terminates the table. 189029e796fdSEric W. Biederman * 189129e796fdSEric W. Biederman * See register_sysctl_paths for more details. 189229e796fdSEric W. Biederman */ 189329e796fdSEric W. Biederman struct ctl_table_header *register_sysctl_table(struct ctl_table *table) 189429e796fdSEric W. Biederman { 189529e796fdSEric W. Biederman static const struct ctl_path null_path[] = { {} }; 189629e796fdSEric W. Biederman 189729e796fdSEric W. Biederman return register_sysctl_paths(null_path, table); 18981da177e4SLinus Torvalds } 18991da177e4SLinus Torvalds 19001da177e4SLinus Torvalds /** 19011da177e4SLinus Torvalds * unregister_sysctl_table - unregister a sysctl table hierarchy 19021da177e4SLinus Torvalds * @header: the header returned from register_sysctl_table 19031da177e4SLinus Torvalds * 19041da177e4SLinus Torvalds * Unregisters the sysctl table and all children. proc entries may not 19051da177e4SLinus Torvalds * actually be removed until they are no longer used by anyone. 19061da177e4SLinus Torvalds */ 19071da177e4SLinus Torvalds void unregister_sysctl_table(struct ctl_table_header * header) 19081da177e4SLinus Torvalds { 1909330d57fbSAl Viro might_sleep(); 1910f1dad166SPavel Emelyanov 1911f1dad166SPavel Emelyanov if (header == NULL) 1912f1dad166SPavel Emelyanov return; 1913f1dad166SPavel Emelyanov 1914330d57fbSAl Viro spin_lock(&sysctl_lock); 1915330d57fbSAl Viro start_unregistering(header); 1916ae7edeccSAl Viro if (!--header->parent->count) { 1917ae7edeccSAl Viro WARN_ON(1); 1918ae7edeccSAl Viro kfree(header->parent); 1919ae7edeccSAl Viro } 1920f7e6ced4SAl Viro if (!--header->count) 19211da177e4SLinus Torvalds kfree(header); 1922f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 19231da177e4SLinus Torvalds } 19241da177e4SLinus Torvalds 19259043476fSAl Viro int sysctl_is_seen(struct ctl_table_header *p) 19269043476fSAl Viro { 19279043476fSAl Viro struct ctl_table_set *set = p->set; 19289043476fSAl Viro int res; 19299043476fSAl Viro spin_lock(&sysctl_lock); 19309043476fSAl Viro if (p->unregistering) 19319043476fSAl Viro res = 0; 19329043476fSAl Viro else if (!set->is_seen) 19339043476fSAl Viro res = 1; 19349043476fSAl Viro else 19359043476fSAl Viro res = set->is_seen(set); 19369043476fSAl Viro spin_unlock(&sysctl_lock); 19379043476fSAl Viro return res; 19389043476fSAl Viro } 19399043476fSAl Viro 194073455092SAl Viro void setup_sysctl_set(struct ctl_table_set *p, 194173455092SAl Viro struct ctl_table_set *parent, 194273455092SAl Viro int (*is_seen)(struct ctl_table_set *)) 194373455092SAl Viro { 194473455092SAl Viro INIT_LIST_HEAD(&p->list); 194573455092SAl Viro p->parent = parent ? parent : &sysctl_table_root.default_set; 194673455092SAl Viro p->is_seen = is_seen; 194773455092SAl Viro } 194873455092SAl Viro 1949b89a8171SEric W. Biederman #else /* !CONFIG_SYSCTL */ 1950d8217f07SEric W. Biederman struct ctl_table_header *register_sysctl_table(struct ctl_table * table) 1951b89a8171SEric W. Biederman { 1952b89a8171SEric W. Biederman return NULL; 1953b89a8171SEric W. Biederman } 1954b89a8171SEric W. Biederman 195529e796fdSEric W. Biederman struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 195629e796fdSEric W. Biederman struct ctl_table *table) 195729e796fdSEric W. Biederman { 195829e796fdSEric W. Biederman return NULL; 195929e796fdSEric W. Biederman } 196029e796fdSEric W. Biederman 1961b89a8171SEric W. Biederman void unregister_sysctl_table(struct ctl_table_header * table) 1962b89a8171SEric W. Biederman { 1963b89a8171SEric W. Biederman } 1964b89a8171SEric W. Biederman 196573455092SAl Viro void setup_sysctl_set(struct ctl_table_set *p, 196673455092SAl Viro struct ctl_table_set *parent, 196773455092SAl Viro int (*is_seen)(struct ctl_table_set *)) 196873455092SAl Viro { 196973455092SAl Viro } 197073455092SAl Viro 1971f7e6ced4SAl Viro void sysctl_head_put(struct ctl_table_header *head) 1972f7e6ced4SAl Viro { 1973f7e6ced4SAl Viro } 1974f7e6ced4SAl Viro 1975b89a8171SEric W. Biederman #endif /* CONFIG_SYSCTL */ 1976b89a8171SEric W. Biederman 19771da177e4SLinus Torvalds /* 19781da177e4SLinus Torvalds * /proc/sys support 19791da177e4SLinus Torvalds */ 19801da177e4SLinus Torvalds 1981b89a8171SEric W. Biederman #ifdef CONFIG_PROC_SYSCTL 19821da177e4SLinus Torvalds 1983b1ba4dddSAdrian Bunk static int _proc_do_string(void* data, int maxlen, int write, 19848d65af78SAlexey Dobriyan void __user *buffer, 1985b1ba4dddSAdrian Bunk size_t *lenp, loff_t *ppos) 1986f5dd3d6fSSam Vilain { 1987f5dd3d6fSSam Vilain size_t len; 1988f5dd3d6fSSam Vilain char __user *p; 1989f5dd3d6fSSam Vilain char c; 1990f5dd3d6fSSam Vilain 19918d060877SOleg Nesterov if (!data || !maxlen || !*lenp) { 1992f5dd3d6fSSam Vilain *lenp = 0; 1993f5dd3d6fSSam Vilain return 0; 1994f5dd3d6fSSam Vilain } 1995f5dd3d6fSSam Vilain 1996f5dd3d6fSSam Vilain if (write) { 1997f5dd3d6fSSam Vilain len = 0; 1998f5dd3d6fSSam Vilain p = buffer; 1999f5dd3d6fSSam Vilain while (len < *lenp) { 2000f5dd3d6fSSam Vilain if (get_user(c, p++)) 2001f5dd3d6fSSam Vilain return -EFAULT; 2002f5dd3d6fSSam Vilain if (c == 0 || c == '\n') 2003f5dd3d6fSSam Vilain break; 2004f5dd3d6fSSam Vilain len++; 2005f5dd3d6fSSam Vilain } 2006f5dd3d6fSSam Vilain if (len >= maxlen) 2007f5dd3d6fSSam Vilain len = maxlen-1; 2008f5dd3d6fSSam Vilain if(copy_from_user(data, buffer, len)) 2009f5dd3d6fSSam Vilain return -EFAULT; 2010f5dd3d6fSSam Vilain ((char *) data)[len] = 0; 2011f5dd3d6fSSam Vilain *ppos += *lenp; 2012f5dd3d6fSSam Vilain } else { 2013f5dd3d6fSSam Vilain len = strlen(data); 2014f5dd3d6fSSam Vilain if (len > maxlen) 2015f5dd3d6fSSam Vilain len = maxlen; 20168d060877SOleg Nesterov 20178d060877SOleg Nesterov if (*ppos > len) { 20188d060877SOleg Nesterov *lenp = 0; 20198d060877SOleg Nesterov return 0; 20208d060877SOleg Nesterov } 20218d060877SOleg Nesterov 20228d060877SOleg Nesterov data += *ppos; 20238d060877SOleg Nesterov len -= *ppos; 20248d060877SOleg Nesterov 2025f5dd3d6fSSam Vilain if (len > *lenp) 2026f5dd3d6fSSam Vilain len = *lenp; 2027f5dd3d6fSSam Vilain if (len) 2028f5dd3d6fSSam Vilain if(copy_to_user(buffer, data, len)) 2029f5dd3d6fSSam Vilain return -EFAULT; 2030f5dd3d6fSSam Vilain if (len < *lenp) { 2031f5dd3d6fSSam Vilain if(put_user('\n', ((char __user *) buffer) + len)) 2032f5dd3d6fSSam Vilain return -EFAULT; 2033f5dd3d6fSSam Vilain len++; 2034f5dd3d6fSSam Vilain } 2035f5dd3d6fSSam Vilain *lenp = len; 2036f5dd3d6fSSam Vilain *ppos += len; 2037f5dd3d6fSSam Vilain } 2038f5dd3d6fSSam Vilain return 0; 2039f5dd3d6fSSam Vilain } 2040f5dd3d6fSSam Vilain 20411da177e4SLinus Torvalds /** 20421da177e4SLinus Torvalds * proc_dostring - read a string sysctl 20431da177e4SLinus Torvalds * @table: the sysctl table 20441da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 20451da177e4SLinus Torvalds * @buffer: the user buffer 20461da177e4SLinus Torvalds * @lenp: the size of the user buffer 20471da177e4SLinus Torvalds * @ppos: file position 20481da177e4SLinus Torvalds * 20491da177e4SLinus Torvalds * Reads/writes a string from/to the user buffer. If the kernel 20501da177e4SLinus Torvalds * buffer provided is not large enough to hold the string, the 20511da177e4SLinus Torvalds * string is truncated. The copied string is %NULL-terminated. 20521da177e4SLinus Torvalds * If the string is being read by the user process, it is copied 20531da177e4SLinus Torvalds * and a newline '\n' is added. It is truncated if the buffer is 20541da177e4SLinus Torvalds * not large enough. 20551da177e4SLinus Torvalds * 20561da177e4SLinus Torvalds * Returns 0 on success. 20571da177e4SLinus Torvalds */ 20588d65af78SAlexey Dobriyan int proc_dostring(struct ctl_table *table, int write, 20591da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 20601da177e4SLinus Torvalds { 20618d65af78SAlexey Dobriyan return _proc_do_string(table->data, table->maxlen, write, 2062f5dd3d6fSSam Vilain buffer, lenp, ppos); 20631da177e4SLinus Torvalds } 20641da177e4SLinus Torvalds 20651da177e4SLinus Torvalds 20661da177e4SLinus Torvalds static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, 20671da177e4SLinus Torvalds int *valp, 20681da177e4SLinus Torvalds int write, void *data) 20691da177e4SLinus Torvalds { 20701da177e4SLinus Torvalds if (write) { 20711da177e4SLinus Torvalds *valp = *negp ? -*lvalp : *lvalp; 20721da177e4SLinus Torvalds } else { 20731da177e4SLinus Torvalds int val = *valp; 20741da177e4SLinus Torvalds if (val < 0) { 20751da177e4SLinus Torvalds *negp = -1; 20761da177e4SLinus Torvalds *lvalp = (unsigned long)-val; 20771da177e4SLinus Torvalds } else { 20781da177e4SLinus Torvalds *negp = 0; 20791da177e4SLinus Torvalds *lvalp = (unsigned long)val; 20801da177e4SLinus Torvalds } 20811da177e4SLinus Torvalds } 20821da177e4SLinus Torvalds return 0; 20831da177e4SLinus Torvalds } 20841da177e4SLinus Torvalds 2085d8217f07SEric W. Biederman static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, 20868d65af78SAlexey Dobriyan int write, void __user *buffer, 2087fcfbd547SKirill Korotaev size_t *lenp, loff_t *ppos, 20881da177e4SLinus Torvalds int (*conv)(int *negp, unsigned long *lvalp, int *valp, 20891da177e4SLinus Torvalds int write, void *data), 20901da177e4SLinus Torvalds void *data) 20911da177e4SLinus Torvalds { 20921da177e4SLinus Torvalds #define TMPBUFLEN 21 20937338f299SSukanto Ghosh int *i, vleft, first = 1, neg; 20941da177e4SLinus Torvalds unsigned long lval; 20951da177e4SLinus Torvalds size_t left, len; 20961da177e4SLinus Torvalds 20971da177e4SLinus Torvalds char buf[TMPBUFLEN], *p; 20981da177e4SLinus Torvalds char __user *s = buffer; 20991da177e4SLinus Torvalds 2100fcfbd547SKirill Korotaev if (!tbl_data || !table->maxlen || !*lenp || 21011da177e4SLinus Torvalds (*ppos && !write)) { 21021da177e4SLinus Torvalds *lenp = 0; 21031da177e4SLinus Torvalds return 0; 21041da177e4SLinus Torvalds } 21051da177e4SLinus Torvalds 2106fcfbd547SKirill Korotaev i = (int *) tbl_data; 21071da177e4SLinus Torvalds vleft = table->maxlen / sizeof(*i); 21081da177e4SLinus Torvalds left = *lenp; 21091da177e4SLinus Torvalds 21101da177e4SLinus Torvalds if (!conv) 21111da177e4SLinus Torvalds conv = do_proc_dointvec_conv; 21121da177e4SLinus Torvalds 21131da177e4SLinus Torvalds for (; left && vleft--; i++, first=0) { 21141da177e4SLinus Torvalds if (write) { 21151da177e4SLinus Torvalds while (left) { 21161da177e4SLinus Torvalds char c; 21171da177e4SLinus Torvalds if (get_user(c, s)) 21181da177e4SLinus Torvalds return -EFAULT; 21191da177e4SLinus Torvalds if (!isspace(c)) 21201da177e4SLinus Torvalds break; 21211da177e4SLinus Torvalds left--; 21221da177e4SLinus Torvalds s++; 21231da177e4SLinus Torvalds } 21241da177e4SLinus Torvalds if (!left) 21251da177e4SLinus Torvalds break; 21261da177e4SLinus Torvalds neg = 0; 21271da177e4SLinus Torvalds len = left; 21281da177e4SLinus Torvalds if (len > sizeof(buf) - 1) 21291da177e4SLinus Torvalds len = sizeof(buf) - 1; 21301da177e4SLinus Torvalds if (copy_from_user(buf, s, len)) 21311da177e4SLinus Torvalds return -EFAULT; 21321da177e4SLinus Torvalds buf[len] = 0; 21331da177e4SLinus Torvalds p = buf; 21341da177e4SLinus Torvalds if (*p == '-' && left > 1) { 21351da177e4SLinus Torvalds neg = 1; 2136bd9b0bacSBP, Praveen p++; 21371da177e4SLinus Torvalds } 21381da177e4SLinus Torvalds if (*p < '0' || *p > '9') 21391da177e4SLinus Torvalds break; 21401da177e4SLinus Torvalds 21411da177e4SLinus Torvalds lval = simple_strtoul(p, &p, 0); 21421da177e4SLinus Torvalds 21431da177e4SLinus Torvalds len = p-buf; 21441da177e4SLinus Torvalds if ((len < left) && *p && !isspace(*p)) 21451da177e4SLinus Torvalds break; 21461da177e4SLinus Torvalds s += len; 21471da177e4SLinus Torvalds left -= len; 21481da177e4SLinus Torvalds 21491da177e4SLinus Torvalds if (conv(&neg, &lval, i, 1, data)) 21501da177e4SLinus Torvalds break; 21511da177e4SLinus Torvalds } else { 21521da177e4SLinus Torvalds p = buf; 21531da177e4SLinus Torvalds if (!first) 21541da177e4SLinus Torvalds *p++ = '\t'; 21551da177e4SLinus Torvalds 21561da177e4SLinus Torvalds if (conv(&neg, &lval, i, 0, data)) 21571da177e4SLinus Torvalds break; 21581da177e4SLinus Torvalds 21591da177e4SLinus Torvalds sprintf(p, "%s%lu", neg ? "-" : "", lval); 21601da177e4SLinus Torvalds len = strlen(buf); 21611da177e4SLinus Torvalds if (len > left) 21621da177e4SLinus Torvalds len = left; 21631da177e4SLinus Torvalds if(copy_to_user(s, buf, len)) 21641da177e4SLinus Torvalds return -EFAULT; 21651da177e4SLinus Torvalds left -= len; 21661da177e4SLinus Torvalds s += len; 21671da177e4SLinus Torvalds } 21681da177e4SLinus Torvalds } 21691da177e4SLinus Torvalds 21701da177e4SLinus Torvalds if (!write && !first && left) { 21711da177e4SLinus Torvalds if(put_user('\n', s)) 21721da177e4SLinus Torvalds return -EFAULT; 21731da177e4SLinus Torvalds left--, s++; 21741da177e4SLinus Torvalds } 21751da177e4SLinus Torvalds if (write) { 21761da177e4SLinus Torvalds while (left) { 21771da177e4SLinus Torvalds char c; 21781da177e4SLinus Torvalds if (get_user(c, s++)) 21791da177e4SLinus Torvalds return -EFAULT; 21801da177e4SLinus Torvalds if (!isspace(c)) 21811da177e4SLinus Torvalds break; 21821da177e4SLinus Torvalds left--; 21831da177e4SLinus Torvalds } 21841da177e4SLinus Torvalds } 21851da177e4SLinus Torvalds if (write && first) 21861da177e4SLinus Torvalds return -EINVAL; 21871da177e4SLinus Torvalds *lenp -= left; 21881da177e4SLinus Torvalds *ppos += *lenp; 21891da177e4SLinus Torvalds return 0; 21901da177e4SLinus Torvalds #undef TMPBUFLEN 21911da177e4SLinus Torvalds } 21921da177e4SLinus Torvalds 21938d65af78SAlexey Dobriyan static int do_proc_dointvec(struct ctl_table *table, int write, 2194fcfbd547SKirill Korotaev void __user *buffer, size_t *lenp, loff_t *ppos, 2195fcfbd547SKirill Korotaev int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2196fcfbd547SKirill Korotaev int write, void *data), 2197fcfbd547SKirill Korotaev void *data) 2198fcfbd547SKirill Korotaev { 21998d65af78SAlexey Dobriyan return __do_proc_dointvec(table->data, table, write, 2200fcfbd547SKirill Korotaev buffer, lenp, ppos, conv, data); 2201fcfbd547SKirill Korotaev } 2202fcfbd547SKirill Korotaev 22031da177e4SLinus Torvalds /** 22041da177e4SLinus Torvalds * proc_dointvec - read a vector of integers 22051da177e4SLinus Torvalds * @table: the sysctl table 22061da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 22071da177e4SLinus Torvalds * @buffer: the user buffer 22081da177e4SLinus Torvalds * @lenp: the size of the user buffer 22091da177e4SLinus Torvalds * @ppos: file position 22101da177e4SLinus Torvalds * 22111da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 22121da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 22131da177e4SLinus Torvalds * 22141da177e4SLinus Torvalds * Returns 0 on success. 22151da177e4SLinus Torvalds */ 22168d65af78SAlexey Dobriyan int proc_dointvec(struct ctl_table *table, int write, 22171da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 22181da177e4SLinus Torvalds { 22198d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 22201da177e4SLinus Torvalds NULL,NULL); 22211da177e4SLinus Torvalds } 22221da177e4SLinus Torvalds 222334f5a398STheodore Ts'o /* 222434f5a398STheodore Ts'o * Taint values can only be increased 222525ddbb18SAndi Kleen * This means we can safely use a temporary. 222634f5a398STheodore Ts'o */ 22278d65af78SAlexey Dobriyan static int proc_taint(struct ctl_table *table, int write, 222834f5a398STheodore Ts'o void __user *buffer, size_t *lenp, loff_t *ppos) 222934f5a398STheodore Ts'o { 223025ddbb18SAndi Kleen struct ctl_table t; 223125ddbb18SAndi Kleen unsigned long tmptaint = get_taint(); 223225ddbb18SAndi Kleen int err; 223334f5a398STheodore Ts'o 223491fcd412SBastian Blank if (write && !capable(CAP_SYS_ADMIN)) 223534f5a398STheodore Ts'o return -EPERM; 223634f5a398STheodore Ts'o 223725ddbb18SAndi Kleen t = *table; 223825ddbb18SAndi Kleen t.data = &tmptaint; 22398d65af78SAlexey Dobriyan err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); 224025ddbb18SAndi Kleen if (err < 0) 224125ddbb18SAndi Kleen return err; 224225ddbb18SAndi Kleen 224325ddbb18SAndi Kleen if (write) { 224425ddbb18SAndi Kleen /* 224525ddbb18SAndi Kleen * Poor man's atomic or. Not worth adding a primitive 224625ddbb18SAndi Kleen * to everyone's atomic.h for this 224725ddbb18SAndi Kleen */ 224825ddbb18SAndi Kleen int i; 224925ddbb18SAndi Kleen for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { 225025ddbb18SAndi Kleen if ((tmptaint >> i) & 1) 225125ddbb18SAndi Kleen add_taint(i); 225225ddbb18SAndi Kleen } 225325ddbb18SAndi Kleen } 225425ddbb18SAndi Kleen 225525ddbb18SAndi Kleen return err; 225634f5a398STheodore Ts'o } 225734f5a398STheodore Ts'o 22581da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param { 22591da177e4SLinus Torvalds int *min; 22601da177e4SLinus Torvalds int *max; 22611da177e4SLinus Torvalds }; 22621da177e4SLinus Torvalds 22631da177e4SLinus Torvalds static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, 22641da177e4SLinus Torvalds int *valp, 22651da177e4SLinus Torvalds int write, void *data) 22661da177e4SLinus Torvalds { 22671da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param *param = data; 22681da177e4SLinus Torvalds if (write) { 22691da177e4SLinus Torvalds int val = *negp ? -*lvalp : *lvalp; 22701da177e4SLinus Torvalds if ((param->min && *param->min > val) || 22711da177e4SLinus Torvalds (param->max && *param->max < val)) 22721da177e4SLinus Torvalds return -EINVAL; 22731da177e4SLinus Torvalds *valp = val; 22741da177e4SLinus Torvalds } else { 22751da177e4SLinus Torvalds int val = *valp; 22761da177e4SLinus Torvalds if (val < 0) { 22771da177e4SLinus Torvalds *negp = -1; 22781da177e4SLinus Torvalds *lvalp = (unsigned long)-val; 22791da177e4SLinus Torvalds } else { 22801da177e4SLinus Torvalds *negp = 0; 22811da177e4SLinus Torvalds *lvalp = (unsigned long)val; 22821da177e4SLinus Torvalds } 22831da177e4SLinus Torvalds } 22841da177e4SLinus Torvalds return 0; 22851da177e4SLinus Torvalds } 22861da177e4SLinus Torvalds 22871da177e4SLinus Torvalds /** 22881da177e4SLinus Torvalds * proc_dointvec_minmax - read a vector of integers with min/max values 22891da177e4SLinus Torvalds * @table: the sysctl table 22901da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 22911da177e4SLinus Torvalds * @buffer: the user buffer 22921da177e4SLinus Torvalds * @lenp: the size of the user buffer 22931da177e4SLinus Torvalds * @ppos: file position 22941da177e4SLinus Torvalds * 22951da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 22961da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 22971da177e4SLinus Torvalds * 22981da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 22991da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 23001da177e4SLinus Torvalds * 23011da177e4SLinus Torvalds * Returns 0 on success. 23021da177e4SLinus Torvalds */ 23038d65af78SAlexey Dobriyan int proc_dointvec_minmax(struct ctl_table *table, int write, 23041da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 23051da177e4SLinus Torvalds { 23061da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param param = { 23071da177e4SLinus Torvalds .min = (int *) table->extra1, 23081da177e4SLinus Torvalds .max = (int *) table->extra2, 23091da177e4SLinus Torvalds }; 23108d65af78SAlexey Dobriyan return do_proc_dointvec(table, write, buffer, lenp, ppos, 23111da177e4SLinus Torvalds do_proc_dointvec_minmax_conv, ¶m); 23121da177e4SLinus Torvalds } 23131da177e4SLinus Torvalds 2314d8217f07SEric W. Biederman static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, 23151da177e4SLinus Torvalds void __user *buffer, 23161da177e4SLinus Torvalds size_t *lenp, loff_t *ppos, 23171da177e4SLinus Torvalds unsigned long convmul, 23181da177e4SLinus Torvalds unsigned long convdiv) 23191da177e4SLinus Torvalds { 23201da177e4SLinus Torvalds #define TMPBUFLEN 21 23211da177e4SLinus Torvalds unsigned long *i, *min, *max, val; 23221da177e4SLinus Torvalds int vleft, first=1, neg; 23231da177e4SLinus Torvalds size_t len, left; 23241da177e4SLinus Torvalds char buf[TMPBUFLEN], *p; 23251da177e4SLinus Torvalds char __user *s = buffer; 23261da177e4SLinus Torvalds 2327fcfbd547SKirill Korotaev if (!data || !table->maxlen || !*lenp || 23281da177e4SLinus Torvalds (*ppos && !write)) { 23291da177e4SLinus Torvalds *lenp = 0; 23301da177e4SLinus Torvalds return 0; 23311da177e4SLinus Torvalds } 23321da177e4SLinus Torvalds 2333fcfbd547SKirill Korotaev i = (unsigned long *) data; 23341da177e4SLinus Torvalds min = (unsigned long *) table->extra1; 23351da177e4SLinus Torvalds max = (unsigned long *) table->extra2; 23361da177e4SLinus Torvalds vleft = table->maxlen / sizeof(unsigned long); 23371da177e4SLinus Torvalds left = *lenp; 23381da177e4SLinus Torvalds 23391da177e4SLinus Torvalds for (; left && vleft--; i++, min++, max++, first=0) { 23401da177e4SLinus Torvalds if (write) { 23411da177e4SLinus Torvalds while (left) { 23421da177e4SLinus Torvalds char c; 23431da177e4SLinus Torvalds if (get_user(c, s)) 23441da177e4SLinus Torvalds return -EFAULT; 23451da177e4SLinus Torvalds if (!isspace(c)) 23461da177e4SLinus Torvalds break; 23471da177e4SLinus Torvalds left--; 23481da177e4SLinus Torvalds s++; 23491da177e4SLinus Torvalds } 23501da177e4SLinus Torvalds if (!left) 23511da177e4SLinus Torvalds break; 23521da177e4SLinus Torvalds neg = 0; 23531da177e4SLinus Torvalds len = left; 23541da177e4SLinus Torvalds if (len > TMPBUFLEN-1) 23551da177e4SLinus Torvalds len = TMPBUFLEN-1; 23561da177e4SLinus Torvalds if (copy_from_user(buf, s, len)) 23571da177e4SLinus Torvalds return -EFAULT; 23581da177e4SLinus Torvalds buf[len] = 0; 23591da177e4SLinus Torvalds p = buf; 23601da177e4SLinus Torvalds if (*p == '-' && left > 1) { 23611da177e4SLinus Torvalds neg = 1; 2362bd9b0bacSBP, Praveen p++; 23631da177e4SLinus Torvalds } 23641da177e4SLinus Torvalds if (*p < '0' || *p > '9') 23651da177e4SLinus Torvalds break; 23661da177e4SLinus Torvalds val = simple_strtoul(p, &p, 0) * convmul / convdiv ; 23671da177e4SLinus Torvalds len = p-buf; 23681da177e4SLinus Torvalds if ((len < left) && *p && !isspace(*p)) 23691da177e4SLinus Torvalds break; 23701da177e4SLinus Torvalds if (neg) 23711da177e4SLinus Torvalds val = -val; 23721da177e4SLinus Torvalds s += len; 23731da177e4SLinus Torvalds left -= len; 23741da177e4SLinus Torvalds 23751da177e4SLinus Torvalds if(neg) 23761da177e4SLinus Torvalds continue; 23771da177e4SLinus Torvalds if ((min && val < *min) || (max && val > *max)) 23781da177e4SLinus Torvalds continue; 23791da177e4SLinus Torvalds *i = val; 23801da177e4SLinus Torvalds } else { 23811da177e4SLinus Torvalds p = buf; 23821da177e4SLinus Torvalds if (!first) 23831da177e4SLinus Torvalds *p++ = '\t'; 23841da177e4SLinus Torvalds sprintf(p, "%lu", convdiv * (*i) / convmul); 23851da177e4SLinus Torvalds len = strlen(buf); 23861da177e4SLinus Torvalds if (len > left) 23871da177e4SLinus Torvalds len = left; 23881da177e4SLinus Torvalds if(copy_to_user(s, buf, len)) 23891da177e4SLinus Torvalds return -EFAULT; 23901da177e4SLinus Torvalds left -= len; 23911da177e4SLinus Torvalds s += len; 23921da177e4SLinus Torvalds } 23931da177e4SLinus Torvalds } 23941da177e4SLinus Torvalds 23951da177e4SLinus Torvalds if (!write && !first && left) { 23961da177e4SLinus Torvalds if(put_user('\n', s)) 23971da177e4SLinus Torvalds return -EFAULT; 23981da177e4SLinus Torvalds left--, s++; 23991da177e4SLinus Torvalds } 24001da177e4SLinus Torvalds if (write) { 24011da177e4SLinus Torvalds while (left) { 24021da177e4SLinus Torvalds char c; 24031da177e4SLinus Torvalds if (get_user(c, s++)) 24041da177e4SLinus Torvalds return -EFAULT; 24051da177e4SLinus Torvalds if (!isspace(c)) 24061da177e4SLinus Torvalds break; 24071da177e4SLinus Torvalds left--; 24081da177e4SLinus Torvalds } 24091da177e4SLinus Torvalds } 24101da177e4SLinus Torvalds if (write && first) 24111da177e4SLinus Torvalds return -EINVAL; 24121da177e4SLinus Torvalds *lenp -= left; 24131da177e4SLinus Torvalds *ppos += *lenp; 24141da177e4SLinus Torvalds return 0; 24151da177e4SLinus Torvalds #undef TMPBUFLEN 24161da177e4SLinus Torvalds } 24171da177e4SLinus Torvalds 2418d8217f07SEric W. Biederman static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, 2419fcfbd547SKirill Korotaev void __user *buffer, 2420fcfbd547SKirill Korotaev size_t *lenp, loff_t *ppos, 2421fcfbd547SKirill Korotaev unsigned long convmul, 2422fcfbd547SKirill Korotaev unsigned long convdiv) 2423fcfbd547SKirill Korotaev { 2424fcfbd547SKirill Korotaev return __do_proc_doulongvec_minmax(table->data, table, write, 24258d65af78SAlexey Dobriyan buffer, lenp, ppos, convmul, convdiv); 2426fcfbd547SKirill Korotaev } 2427fcfbd547SKirill Korotaev 24281da177e4SLinus Torvalds /** 24291da177e4SLinus Torvalds * proc_doulongvec_minmax - read a vector of long integers with min/max values 24301da177e4SLinus Torvalds * @table: the sysctl table 24311da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 24321da177e4SLinus Torvalds * @buffer: the user buffer 24331da177e4SLinus Torvalds * @lenp: the size of the user buffer 24341da177e4SLinus Torvalds * @ppos: file position 24351da177e4SLinus Torvalds * 24361da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 24371da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 24381da177e4SLinus Torvalds * 24391da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 24401da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 24411da177e4SLinus Torvalds * 24421da177e4SLinus Torvalds * Returns 0 on success. 24431da177e4SLinus Torvalds */ 24448d65af78SAlexey Dobriyan int proc_doulongvec_minmax(struct ctl_table *table, int write, 24451da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 24461da177e4SLinus Torvalds { 24478d65af78SAlexey Dobriyan return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); 24481da177e4SLinus Torvalds } 24491da177e4SLinus Torvalds 24501da177e4SLinus Torvalds /** 24511da177e4SLinus Torvalds * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values 24521da177e4SLinus Torvalds * @table: the sysctl table 24531da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 24541da177e4SLinus Torvalds * @buffer: the user buffer 24551da177e4SLinus Torvalds * @lenp: the size of the user buffer 24561da177e4SLinus Torvalds * @ppos: file position 24571da177e4SLinus Torvalds * 24581da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 24591da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. The values 24601da177e4SLinus Torvalds * are treated as milliseconds, and converted to jiffies when they are stored. 24611da177e4SLinus Torvalds * 24621da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 24631da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 24641da177e4SLinus Torvalds * 24651da177e4SLinus Torvalds * Returns 0 on success. 24661da177e4SLinus Torvalds */ 2467d8217f07SEric W. Biederman int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 24681da177e4SLinus Torvalds void __user *buffer, 24691da177e4SLinus Torvalds size_t *lenp, loff_t *ppos) 24701da177e4SLinus Torvalds { 24718d65af78SAlexey Dobriyan return do_proc_doulongvec_minmax(table, write, buffer, 24721da177e4SLinus Torvalds lenp, ppos, HZ, 1000l); 24731da177e4SLinus Torvalds } 24741da177e4SLinus Torvalds 24751da177e4SLinus Torvalds 24761da177e4SLinus Torvalds static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp, 24771da177e4SLinus Torvalds int *valp, 24781da177e4SLinus Torvalds int write, void *data) 24791da177e4SLinus Torvalds { 24801da177e4SLinus Torvalds if (write) { 2481cba9f33dSBart Samwel if (*lvalp > LONG_MAX / HZ) 2482cba9f33dSBart Samwel return 1; 24831da177e4SLinus Torvalds *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); 24841da177e4SLinus Torvalds } else { 24851da177e4SLinus Torvalds int val = *valp; 24861da177e4SLinus Torvalds unsigned long lval; 24871da177e4SLinus Torvalds if (val < 0) { 24881da177e4SLinus Torvalds *negp = -1; 24891da177e4SLinus Torvalds lval = (unsigned long)-val; 24901da177e4SLinus Torvalds } else { 24911da177e4SLinus Torvalds *negp = 0; 24921da177e4SLinus Torvalds lval = (unsigned long)val; 24931da177e4SLinus Torvalds } 24941da177e4SLinus Torvalds *lvalp = lval / HZ; 24951da177e4SLinus Torvalds } 24961da177e4SLinus Torvalds return 0; 24971da177e4SLinus Torvalds } 24981da177e4SLinus Torvalds 24991da177e4SLinus Torvalds static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, 25001da177e4SLinus Torvalds int *valp, 25011da177e4SLinus Torvalds int write, void *data) 25021da177e4SLinus Torvalds { 25031da177e4SLinus Torvalds if (write) { 2504cba9f33dSBart Samwel if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) 2505cba9f33dSBart Samwel return 1; 25061da177e4SLinus Torvalds *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); 25071da177e4SLinus Torvalds } else { 25081da177e4SLinus Torvalds int val = *valp; 25091da177e4SLinus Torvalds unsigned long lval; 25101da177e4SLinus Torvalds if (val < 0) { 25111da177e4SLinus Torvalds *negp = -1; 25121da177e4SLinus Torvalds lval = (unsigned long)-val; 25131da177e4SLinus Torvalds } else { 25141da177e4SLinus Torvalds *negp = 0; 25151da177e4SLinus Torvalds lval = (unsigned long)val; 25161da177e4SLinus Torvalds } 25171da177e4SLinus Torvalds *lvalp = jiffies_to_clock_t(lval); 25181da177e4SLinus Torvalds } 25191da177e4SLinus Torvalds return 0; 25201da177e4SLinus Torvalds } 25211da177e4SLinus Torvalds 25221da177e4SLinus Torvalds static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, 25231da177e4SLinus Torvalds int *valp, 25241da177e4SLinus Torvalds int write, void *data) 25251da177e4SLinus Torvalds { 25261da177e4SLinus Torvalds if (write) { 25271da177e4SLinus Torvalds *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); 25281da177e4SLinus Torvalds } else { 25291da177e4SLinus Torvalds int val = *valp; 25301da177e4SLinus Torvalds unsigned long lval; 25311da177e4SLinus Torvalds if (val < 0) { 25321da177e4SLinus Torvalds *negp = -1; 25331da177e4SLinus Torvalds lval = (unsigned long)-val; 25341da177e4SLinus Torvalds } else { 25351da177e4SLinus Torvalds *negp = 0; 25361da177e4SLinus Torvalds lval = (unsigned long)val; 25371da177e4SLinus Torvalds } 25381da177e4SLinus Torvalds *lvalp = jiffies_to_msecs(lval); 25391da177e4SLinus Torvalds } 25401da177e4SLinus Torvalds return 0; 25411da177e4SLinus Torvalds } 25421da177e4SLinus Torvalds 25431da177e4SLinus Torvalds /** 25441da177e4SLinus Torvalds * proc_dointvec_jiffies - read a vector of integers as seconds 25451da177e4SLinus Torvalds * @table: the sysctl table 25461da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25471da177e4SLinus Torvalds * @buffer: the user buffer 25481da177e4SLinus Torvalds * @lenp: the size of the user buffer 25491da177e4SLinus Torvalds * @ppos: file position 25501da177e4SLinus Torvalds * 25511da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25521da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25531da177e4SLinus Torvalds * The values read are assumed to be in seconds, and are converted into 25541da177e4SLinus Torvalds * jiffies. 25551da177e4SLinus Torvalds * 25561da177e4SLinus Torvalds * Returns 0 on success. 25571da177e4SLinus Torvalds */ 25588d65af78SAlexey Dobriyan int proc_dointvec_jiffies(struct ctl_table *table, int write, 25591da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 25601da177e4SLinus Torvalds { 25618d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 25621da177e4SLinus Torvalds do_proc_dointvec_jiffies_conv,NULL); 25631da177e4SLinus Torvalds } 25641da177e4SLinus Torvalds 25651da177e4SLinus Torvalds /** 25661da177e4SLinus Torvalds * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds 25671da177e4SLinus Torvalds * @table: the sysctl table 25681da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25691da177e4SLinus Torvalds * @buffer: the user buffer 25701da177e4SLinus Torvalds * @lenp: the size of the user buffer 25711e5d5331SRandy Dunlap * @ppos: pointer to the file position 25721da177e4SLinus Torvalds * 25731da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25741da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25751da177e4SLinus Torvalds * The values read are assumed to be in 1/USER_HZ seconds, and 25761da177e4SLinus Torvalds * are converted into jiffies. 25771da177e4SLinus Torvalds * 25781da177e4SLinus Torvalds * Returns 0 on success. 25791da177e4SLinus Torvalds */ 25808d65af78SAlexey Dobriyan int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 25811da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 25821da177e4SLinus Torvalds { 25838d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 25841da177e4SLinus Torvalds do_proc_dointvec_userhz_jiffies_conv,NULL); 25851da177e4SLinus Torvalds } 25861da177e4SLinus Torvalds 25871da177e4SLinus Torvalds /** 25881da177e4SLinus Torvalds * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds 25891da177e4SLinus Torvalds * @table: the sysctl table 25901da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25911da177e4SLinus Torvalds * @buffer: the user buffer 25921da177e4SLinus Torvalds * @lenp: the size of the user buffer 259367be2dd1SMartin Waitz * @ppos: file position 259467be2dd1SMartin Waitz * @ppos: the current position in the file 25951da177e4SLinus Torvalds * 25961da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25971da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25981da177e4SLinus Torvalds * The values read are assumed to be in 1/1000 seconds, and 25991da177e4SLinus Torvalds * are converted into jiffies. 26001da177e4SLinus Torvalds * 26011da177e4SLinus Torvalds * Returns 0 on success. 26021da177e4SLinus Torvalds */ 26038d65af78SAlexey Dobriyan int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 26041da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26051da177e4SLinus Torvalds { 26068d65af78SAlexey Dobriyan return do_proc_dointvec(table, write, buffer, lenp, ppos, 26071da177e4SLinus Torvalds do_proc_dointvec_ms_jiffies_conv, NULL); 26081da177e4SLinus Torvalds } 26091da177e4SLinus Torvalds 26108d65af78SAlexey Dobriyan static int proc_do_cad_pid(struct ctl_table *table, int write, 26119ec52099SCedric Le Goater void __user *buffer, size_t *lenp, loff_t *ppos) 26129ec52099SCedric Le Goater { 26139ec52099SCedric Le Goater struct pid *new_pid; 26149ec52099SCedric Le Goater pid_t tmp; 26159ec52099SCedric Le Goater int r; 26169ec52099SCedric Le Goater 26176c5f3e7bSPavel Emelyanov tmp = pid_vnr(cad_pid); 26189ec52099SCedric Le Goater 26198d65af78SAlexey Dobriyan r = __do_proc_dointvec(&tmp, table, write, buffer, 26209ec52099SCedric Le Goater lenp, ppos, NULL, NULL); 26219ec52099SCedric Le Goater if (r || !write) 26229ec52099SCedric Le Goater return r; 26239ec52099SCedric Le Goater 26249ec52099SCedric Le Goater new_pid = find_get_pid(tmp); 26259ec52099SCedric Le Goater if (!new_pid) 26269ec52099SCedric Le Goater return -ESRCH; 26279ec52099SCedric Le Goater 26289ec52099SCedric Le Goater put_pid(xchg(&cad_pid, new_pid)); 26299ec52099SCedric Le Goater return 0; 26309ec52099SCedric Le Goater } 26319ec52099SCedric Le Goater 26321da177e4SLinus Torvalds #else /* CONFIG_PROC_FS */ 26331da177e4SLinus Torvalds 26348d65af78SAlexey Dobriyan int proc_dostring(struct ctl_table *table, int write, 26351da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26361da177e4SLinus Torvalds { 26371da177e4SLinus Torvalds return -ENOSYS; 26381da177e4SLinus Torvalds } 26391da177e4SLinus Torvalds 26408d65af78SAlexey Dobriyan int proc_dointvec(struct ctl_table *table, int write, 26411da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26421da177e4SLinus Torvalds { 26431da177e4SLinus Torvalds return -ENOSYS; 26441da177e4SLinus Torvalds } 26451da177e4SLinus Torvalds 26468d65af78SAlexey Dobriyan int proc_dointvec_minmax(struct ctl_table *table, int write, 26471da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26481da177e4SLinus Torvalds { 26491da177e4SLinus Torvalds return -ENOSYS; 26501da177e4SLinus Torvalds } 26511da177e4SLinus Torvalds 26528d65af78SAlexey Dobriyan int proc_dointvec_jiffies(struct ctl_table *table, int write, 26531da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26541da177e4SLinus Torvalds { 26551da177e4SLinus Torvalds return -ENOSYS; 26561da177e4SLinus Torvalds } 26571da177e4SLinus Torvalds 26588d65af78SAlexey Dobriyan int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 26591da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26601da177e4SLinus Torvalds { 26611da177e4SLinus Torvalds return -ENOSYS; 26621da177e4SLinus Torvalds } 26631da177e4SLinus Torvalds 26648d65af78SAlexey Dobriyan int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 26651da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26661da177e4SLinus Torvalds { 26671da177e4SLinus Torvalds return -ENOSYS; 26681da177e4SLinus Torvalds } 26691da177e4SLinus Torvalds 26708d65af78SAlexey Dobriyan int proc_doulongvec_minmax(struct ctl_table *table, int write, 26711da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26721da177e4SLinus Torvalds { 26731da177e4SLinus Torvalds return -ENOSYS; 26741da177e4SLinus Torvalds } 26751da177e4SLinus Torvalds 2676d8217f07SEric W. Biederman int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 26771da177e4SLinus Torvalds void __user *buffer, 26781da177e4SLinus Torvalds size_t *lenp, loff_t *ppos) 26791da177e4SLinus Torvalds { 26801da177e4SLinus Torvalds return -ENOSYS; 26811da177e4SLinus Torvalds } 26821da177e4SLinus Torvalds 26831da177e4SLinus Torvalds 26841da177e4SLinus Torvalds #endif /* CONFIG_PROC_FS */ 26851da177e4SLinus Torvalds 26861da177e4SLinus Torvalds /* 26871da177e4SLinus Torvalds * No sense putting this after each symbol definition, twice, 26881da177e4SLinus Torvalds * exception granted :-) 26891da177e4SLinus Torvalds */ 26901da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec); 26911da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_jiffies); 26921da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_minmax); 26931da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); 26941da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_ms_jiffies); 26951da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dostring); 26961da177e4SLinus Torvalds EXPORT_SYMBOL(proc_doulongvec_minmax); 26971da177e4SLinus Torvalds EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); 26981da177e4SLinus Torvalds EXPORT_SYMBOL(register_sysctl_table); 269929e796fdSEric W. Biederman EXPORT_SYMBOL(register_sysctl_paths); 27001da177e4SLinus Torvalds EXPORT_SYMBOL(unregister_sysctl_table); 2701