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 777058cb02SEric W. Biederman 781da177e4SLinus Torvalds #if defined(CONFIG_SYSCTL) 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds /* External variables not in a header file. */ 811da177e4SLinus Torvalds extern int sysctl_overcommit_memory; 821da177e4SLinus Torvalds extern int sysctl_overcommit_ratio; 83fadd8fbdSKAMEZAWA Hiroyuki extern int sysctl_panic_on_oom; 84fe071d7eSDavid Rientjes extern int sysctl_oom_kill_allocating_task; 85fef1bdd6SDavid Rientjes extern int sysctl_oom_dump_tasks; 861da177e4SLinus Torvalds extern int max_threads; 871da177e4SLinus Torvalds extern int core_uses_pid; 88d6e71144SAlan Cox extern int suid_dumpable; 891da177e4SLinus Torvalds extern char core_pattern[]; 90a293980cSNeil Horman extern unsigned int core_pipe_limit; 911da177e4SLinus Torvalds extern int pid_max; 921da177e4SLinus Torvalds extern int min_free_kbytes; 931da177e4SLinus Torvalds extern int pid_max_min, pid_max_max; 949d0243bcSAndrew Morton extern int sysctl_drop_caches; 958ad4b1fbSRohit Seth extern int percpu_pagelist_fraction; 96bebfa101SAndi Kleen extern int compat_log; 979745512cSArjan van de Ven extern int latencytop_enabled; 98eceea0b3SAl Viro extern int sysctl_nr_open_min, sysctl_nr_open_max; 99dd8632a1SPaul Mundt #ifndef CONFIG_MMU 100dd8632a1SPaul Mundt extern int sysctl_nr_trim_pages; 101dd8632a1SPaul Mundt #endif 102cb684b5bSJens Axboe #ifdef CONFIG_BLOCK 1035e605b64SJens Axboe extern int blk_iopoll_enabled; 104cb684b5bSJens Axboe #endif 1051da177e4SLinus Torvalds 106c4f3b63fSRavikiran G Thirumalai /* Constants used for minimum and maximum */ 107195cf453SBron Gondwana #ifdef CONFIG_DETECT_SOFTLOCKUP 108c4f3b63fSRavikiran G Thirumalai static int sixty = 60; 1099383d967SDimitri Sivanich static int neg_one = -1; 110c4f3b63fSRavikiran G Thirumalai #endif 111c4f3b63fSRavikiran G Thirumalai 112c4f3b63fSRavikiran G Thirumalai static int zero; 113cd5f9a4cSLinus Torvalds static int __maybe_unused one = 1; 114cd5f9a4cSLinus Torvalds static int __maybe_unused two = 2; 115fc3501d4SSven Wegener static unsigned long one_ul = 1; 116c4f3b63fSRavikiran G Thirumalai static int one_hundred = 100; 117af91322eSDave Young #ifdef CONFIG_PRINTK 118af91322eSDave Young static int ten_thousand = 10000; 119af91322eSDave Young #endif 120c4f3b63fSRavikiran G Thirumalai 1219e4a5bdaSAndrea Righi /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ 1229e4a5bdaSAndrea Righi static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; 1239e4a5bdaSAndrea Righi 1241da177e4SLinus Torvalds /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 1251da177e4SLinus Torvalds static int maxolduid = 65535; 1261da177e4SLinus Torvalds static int minolduid; 1278ad4b1fbSRohit Seth static int min_percpu_pagelist_fract = 8; 1281da177e4SLinus Torvalds 1291da177e4SLinus Torvalds static int ngroups_max = NGROUPS_MAX; 1301da177e4SLinus Torvalds 13172c57ed5SDavid S. Miller #ifdef CONFIG_SPARC 13217f04fbbSDavid S. Miller #include <asm/system.h> 1331da177e4SLinus Torvalds #endif 1341da177e4SLinus Torvalds 1350871420fSDavid S. Miller #ifdef CONFIG_SPARC64 1360871420fSDavid S. Miller extern int sysctl_tsb_ratio; 1370871420fSDavid S. Miller #endif 1380871420fSDavid S. Miller 1391da177e4SLinus Torvalds #ifdef __hppa__ 1401da177e4SLinus Torvalds extern int pwrsw_enabled; 1411da177e4SLinus Torvalds extern int unaligned_enabled; 1421da177e4SLinus Torvalds #endif 1431da177e4SLinus Torvalds 144347a8dc3SMartin Schwidefsky #ifdef CONFIG_S390 1451da177e4SLinus Torvalds #ifdef CONFIG_MATHEMU 1461da177e4SLinus Torvalds extern int sysctl_ieee_emulation_warnings; 1471da177e4SLinus Torvalds #endif 1481da177e4SLinus Torvalds extern int sysctl_userprocess_debug; 149951f22d5SMartin Schwidefsky extern int spin_retry; 1501da177e4SLinus Torvalds #endif 1511da177e4SLinus Torvalds 152d2b176edSJes Sorensen #ifdef CONFIG_IA64 153d2b176edSJes Sorensen extern int no_unaligned_warning; 15488fc241fSDoug Chapman extern int unaligned_dump_stack; 155d2b176edSJes Sorensen #endif 156d2b176edSJes Sorensen 1573fff4c42SIngo Molnar extern struct ratelimit_state printk_ratelimit_state; 1583fff4c42SIngo Molnar 159d6f8ff73SRandy Dunlap #ifdef CONFIG_PROC_SYSCTL 1608d65af78SAlexey Dobriyan static int proc_do_cad_pid(struct ctl_table *table, int write, 1619ec52099SCedric Le Goater void __user *buffer, size_t *lenp, loff_t *ppos); 1628d65af78SAlexey Dobriyan static int proc_taint(struct ctl_table *table, int write, 16334f5a398STheodore Ts'o void __user *buffer, size_t *lenp, loff_t *ppos); 164d6f8ff73SRandy Dunlap #endif 1659ec52099SCedric Le Goater 166*97f5f0cdSDmitry Torokhov #ifdef CONFIG_MAGIC_SYSRQ 167*97f5f0cdSDmitry Torokhov static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ 168*97f5f0cdSDmitry Torokhov 169*97f5f0cdSDmitry Torokhov static int sysrq_sysctl_handler(ctl_table *table, int write, 170*97f5f0cdSDmitry Torokhov void __user *buffer, size_t *lenp, 171*97f5f0cdSDmitry Torokhov loff_t *ppos) 172*97f5f0cdSDmitry Torokhov { 173*97f5f0cdSDmitry Torokhov int error; 174*97f5f0cdSDmitry Torokhov 175*97f5f0cdSDmitry Torokhov error = proc_dointvec(table, write, buffer, lenp, ppos); 176*97f5f0cdSDmitry Torokhov if (error) 177*97f5f0cdSDmitry Torokhov return error; 178*97f5f0cdSDmitry Torokhov 179*97f5f0cdSDmitry Torokhov if (write) 180*97f5f0cdSDmitry Torokhov sysrq_toggle_support(__sysrq_enabled); 181*97f5f0cdSDmitry Torokhov 182*97f5f0cdSDmitry Torokhov return 0; 183*97f5f0cdSDmitry Torokhov } 184*97f5f0cdSDmitry Torokhov 185*97f5f0cdSDmitry Torokhov #endif 186*97f5f0cdSDmitry Torokhov 187d8217f07SEric W. Biederman static struct ctl_table root_table[]; 188e51b6ba0SEric W. Biederman static struct ctl_table_root sysctl_table_root; 189e51b6ba0SEric W. Biederman static struct ctl_table_header root_table_header = { 190b380b0d4SAl Viro .count = 1, 191e51b6ba0SEric W. Biederman .ctl_table = root_table, 19273455092SAl Viro .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list), 193e51b6ba0SEric W. Biederman .root = &sysctl_table_root, 19473455092SAl Viro .set = &sysctl_table_root.default_set, 195e51b6ba0SEric W. Biederman }; 196e51b6ba0SEric W. Biederman static struct ctl_table_root sysctl_table_root = { 197e51b6ba0SEric W. Biederman .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list), 19873455092SAl Viro .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry), 199e51b6ba0SEric W. Biederman }; 2001da177e4SLinus Torvalds 201d8217f07SEric W. Biederman static struct ctl_table kern_table[]; 202d8217f07SEric W. Biederman static struct ctl_table vm_table[]; 203d8217f07SEric W. Biederman static struct ctl_table fs_table[]; 204d8217f07SEric W. Biederman static struct ctl_table debug_table[]; 205d8217f07SEric W. Biederman static struct ctl_table dev_table[]; 206d8217f07SEric W. Biederman extern struct ctl_table random_table[]; 2072d9048e2SAmy Griffis #ifdef CONFIG_INOTIFY_USER 208d8217f07SEric W. Biederman extern struct ctl_table inotify_table[]; 2090399cb08SRobert Love #endif 2107ef9964eSDavide Libenzi #ifdef CONFIG_EPOLL 2117ef9964eSDavide Libenzi extern struct ctl_table epoll_table[]; 2127ef9964eSDavide Libenzi #endif 2131da177e4SLinus Torvalds 2141da177e4SLinus Torvalds #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 2151da177e4SLinus Torvalds int sysctl_legacy_va_layout; 2161da177e4SLinus Torvalds #endif 2171da177e4SLinus Torvalds 2181da177e4SLinus Torvalds /* The default sysctl tables: */ 2191da177e4SLinus Torvalds 220d8217f07SEric W. Biederman static struct ctl_table root_table[] = { 2211da177e4SLinus Torvalds { 2221da177e4SLinus Torvalds .procname = "kernel", 2231da177e4SLinus Torvalds .mode = 0555, 2241da177e4SLinus Torvalds .child = kern_table, 2251da177e4SLinus Torvalds }, 2261da177e4SLinus Torvalds { 2271da177e4SLinus Torvalds .procname = "vm", 2281da177e4SLinus Torvalds .mode = 0555, 2291da177e4SLinus Torvalds .child = vm_table, 2301da177e4SLinus Torvalds }, 2311da177e4SLinus Torvalds { 2321da177e4SLinus Torvalds .procname = "fs", 2331da177e4SLinus Torvalds .mode = 0555, 2341da177e4SLinus Torvalds .child = fs_table, 2351da177e4SLinus Torvalds }, 2361da177e4SLinus Torvalds { 2371da177e4SLinus Torvalds .procname = "debug", 2381da177e4SLinus Torvalds .mode = 0555, 2391da177e4SLinus Torvalds .child = debug_table, 2401da177e4SLinus Torvalds }, 2411da177e4SLinus Torvalds { 2421da177e4SLinus Torvalds .procname = "dev", 2431da177e4SLinus Torvalds .mode = 0555, 2441da177e4SLinus Torvalds .child = dev_table, 2451da177e4SLinus Torvalds }, 2462be7fe07SAndrew Morton /* 2472be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 2482be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 2492be7fe07SAndrew Morton */ 2506fce56ecSEric W. Biederman { } 2511da177e4SLinus Torvalds }; 2521da177e4SLinus Torvalds 25377e54a1fSIngo Molnar #ifdef CONFIG_SCHED_DEBUG 25473c4efd2SEric Dumazet static int min_sched_granularity_ns = 100000; /* 100 usecs */ 25573c4efd2SEric Dumazet static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 25673c4efd2SEric Dumazet static int min_wakeup_granularity_ns; /* 0 usecs */ 25773c4efd2SEric Dumazet static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 2581983a922SChristian Ehrhardt static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; 2591983a922SChristian Ehrhardt static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; 260acb4a848SChristian Ehrhardt static int min_sched_shares_ratelimit = 100000; /* 100 usec */ 261acb4a848SChristian Ehrhardt static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ 26277e54a1fSIngo Molnar #endif 26377e54a1fSIngo Molnar 264d8217f07SEric W. Biederman static struct ctl_table kern_table[] = { 2652bba22c5SMike Galbraith { 2662bba22c5SMike Galbraith .procname = "sched_child_runs_first", 2672bba22c5SMike Galbraith .data = &sysctl_sched_child_runs_first, 2682bba22c5SMike Galbraith .maxlen = sizeof(unsigned int), 2692bba22c5SMike Galbraith .mode = 0644, 2706d456111SEric W. Biederman .proc_handler = proc_dointvec, 2712bba22c5SMike Galbraith }, 27277e54a1fSIngo Molnar #ifdef CONFIG_SCHED_DEBUG 27377e54a1fSIngo Molnar { 274b2be5e96SPeter Zijlstra .procname = "sched_min_granularity_ns", 275b2be5e96SPeter Zijlstra .data = &sysctl_sched_min_granularity, 27677e54a1fSIngo Molnar .maxlen = sizeof(unsigned int), 27777e54a1fSIngo Molnar .mode = 0644, 278702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 279b2be5e96SPeter Zijlstra .extra1 = &min_sched_granularity_ns, 280b2be5e96SPeter Zijlstra .extra2 = &max_sched_granularity_ns, 28177e54a1fSIngo Molnar }, 28277e54a1fSIngo Molnar { 28321805085SPeter Zijlstra .procname = "sched_latency_ns", 28421805085SPeter Zijlstra .data = &sysctl_sched_latency, 28521805085SPeter Zijlstra .maxlen = sizeof(unsigned int), 28621805085SPeter Zijlstra .mode = 0644, 287702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 28821805085SPeter Zijlstra .extra1 = &min_sched_granularity_ns, 28921805085SPeter Zijlstra .extra2 = &max_sched_granularity_ns, 29021805085SPeter Zijlstra }, 29121805085SPeter Zijlstra { 29277e54a1fSIngo Molnar .procname = "sched_wakeup_granularity_ns", 29377e54a1fSIngo Molnar .data = &sysctl_sched_wakeup_granularity, 29477e54a1fSIngo Molnar .maxlen = sizeof(unsigned int), 29577e54a1fSIngo Molnar .mode = 0644, 296702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 29777e54a1fSIngo Molnar .extra1 = &min_wakeup_granularity_ns, 29877e54a1fSIngo Molnar .extra2 = &max_wakeup_granularity_ns, 29977e54a1fSIngo Molnar }, 30077e54a1fSIngo Molnar { 3012398f2c6SPeter Zijlstra .procname = "sched_shares_ratelimit", 3022398f2c6SPeter Zijlstra .data = &sysctl_sched_shares_ratelimit, 3032398f2c6SPeter Zijlstra .maxlen = sizeof(unsigned int), 3042398f2c6SPeter Zijlstra .mode = 0644, 305702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 306acb4a848SChristian Ehrhardt .extra1 = &min_sched_shares_ratelimit, 307acb4a848SChristian Ehrhardt .extra2 = &max_sched_shares_ratelimit, 3082398f2c6SPeter Zijlstra }, 3092398f2c6SPeter Zijlstra { 3101983a922SChristian Ehrhardt .procname = "sched_tunable_scaling", 3111983a922SChristian Ehrhardt .data = &sysctl_sched_tunable_scaling, 3121983a922SChristian Ehrhardt .maxlen = sizeof(enum sched_tunable_scaling), 3131983a922SChristian Ehrhardt .mode = 0644, 314702a7c76SLinus Torvalds .proc_handler = sched_proc_update_handler, 3151983a922SChristian Ehrhardt .extra1 = &min_sched_tunable_scaling, 3161983a922SChristian Ehrhardt .extra2 = &max_sched_tunable_scaling, 3172398f2c6SPeter Zijlstra }, 3182398f2c6SPeter Zijlstra { 319ffda12a1SPeter Zijlstra .procname = "sched_shares_thresh", 320ffda12a1SPeter Zijlstra .data = &sysctl_sched_shares_thresh, 321ffda12a1SPeter Zijlstra .maxlen = sizeof(unsigned int), 322ffda12a1SPeter Zijlstra .mode = 0644, 3236d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 324ffda12a1SPeter Zijlstra .extra1 = &zero, 325ffda12a1SPeter Zijlstra }, 326ffda12a1SPeter Zijlstra { 327da84d961SIngo Molnar .procname = "sched_migration_cost", 328da84d961SIngo Molnar .data = &sysctl_sched_migration_cost, 329da84d961SIngo Molnar .maxlen = sizeof(unsigned int), 330da84d961SIngo Molnar .mode = 0644, 3316d456111SEric W. Biederman .proc_handler = proc_dointvec, 332da84d961SIngo Molnar }, 333b82d9fddSPeter Zijlstra { 334b82d9fddSPeter Zijlstra .procname = "sched_nr_migrate", 335b82d9fddSPeter Zijlstra .data = &sysctl_sched_nr_migrate, 336b82d9fddSPeter Zijlstra .maxlen = sizeof(unsigned int), 337fa85ae24SPeter Zijlstra .mode = 0644, 3386d456111SEric W. Biederman .proc_handler = proc_dointvec, 339fa85ae24SPeter Zijlstra }, 340cd1bb94bSArun R Bharadwaj { 341e9e9250bSPeter Zijlstra .procname = "sched_time_avg", 342e9e9250bSPeter Zijlstra .data = &sysctl_sched_time_avg, 343e9e9250bSPeter Zijlstra .maxlen = sizeof(unsigned int), 344e9e9250bSPeter Zijlstra .mode = 0644, 3456d456111SEric W. Biederman .proc_handler = proc_dointvec, 346e9e9250bSPeter Zijlstra }, 347e9e9250bSPeter Zijlstra { 348cd1bb94bSArun R Bharadwaj .procname = "timer_migration", 349cd1bb94bSArun R Bharadwaj .data = &sysctl_timer_migration, 350cd1bb94bSArun R Bharadwaj .maxlen = sizeof(unsigned int), 351cd1bb94bSArun R Bharadwaj .mode = 0644, 3526d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 353bfdb4d9fSArun R Bharadwaj .extra1 = &zero, 354bfdb4d9fSArun R Bharadwaj .extra2 = &one, 355cd1bb94bSArun R Bharadwaj }, 3561fc84aaaSPeter Zijlstra #endif 3571799e35dSIngo Molnar { 3589f0c1e56SPeter Zijlstra .procname = "sched_rt_period_us", 3599f0c1e56SPeter Zijlstra .data = &sysctl_sched_rt_period, 3609f0c1e56SPeter Zijlstra .maxlen = sizeof(unsigned int), 3619f0c1e56SPeter Zijlstra .mode = 0644, 3626d456111SEric W. Biederman .proc_handler = sched_rt_handler, 3639f0c1e56SPeter Zijlstra }, 3649f0c1e56SPeter Zijlstra { 3659f0c1e56SPeter Zijlstra .procname = "sched_rt_runtime_us", 3669f0c1e56SPeter Zijlstra .data = &sysctl_sched_rt_runtime, 3679f0c1e56SPeter Zijlstra .maxlen = sizeof(int), 3689f0c1e56SPeter Zijlstra .mode = 0644, 3696d456111SEric W. Biederman .proc_handler = sched_rt_handler, 3709f0c1e56SPeter Zijlstra }, 3719f0c1e56SPeter Zijlstra { 3721799e35dSIngo Molnar .procname = "sched_compat_yield", 3731799e35dSIngo Molnar .data = &sysctl_sched_compat_yield, 3741799e35dSIngo Molnar .maxlen = sizeof(unsigned int), 3751799e35dSIngo Molnar .mode = 0644, 3766d456111SEric W. Biederman .proc_handler = proc_dointvec, 3771799e35dSIngo Molnar }, 378f20786ffSPeter Zijlstra #ifdef CONFIG_PROVE_LOCKING 379f20786ffSPeter Zijlstra { 380f20786ffSPeter Zijlstra .procname = "prove_locking", 381f20786ffSPeter Zijlstra .data = &prove_locking, 382f20786ffSPeter Zijlstra .maxlen = sizeof(int), 383f20786ffSPeter Zijlstra .mode = 0644, 3846d456111SEric W. Biederman .proc_handler = proc_dointvec, 385f20786ffSPeter Zijlstra }, 386f20786ffSPeter Zijlstra #endif 387f20786ffSPeter Zijlstra #ifdef CONFIG_LOCK_STAT 388f20786ffSPeter Zijlstra { 389f20786ffSPeter Zijlstra .procname = "lock_stat", 390f20786ffSPeter Zijlstra .data = &lock_stat, 391f20786ffSPeter Zijlstra .maxlen = sizeof(int), 392f20786ffSPeter Zijlstra .mode = 0644, 3936d456111SEric W. Biederman .proc_handler = proc_dointvec, 394f20786ffSPeter Zijlstra }, 395f20786ffSPeter Zijlstra #endif 39677e54a1fSIngo Molnar { 3971da177e4SLinus Torvalds .procname = "panic", 3981da177e4SLinus Torvalds .data = &panic_timeout, 3991da177e4SLinus Torvalds .maxlen = sizeof(int), 4001da177e4SLinus Torvalds .mode = 0644, 4016d456111SEric W. Biederman .proc_handler = proc_dointvec, 4021da177e4SLinus Torvalds }, 4031da177e4SLinus Torvalds { 4041da177e4SLinus Torvalds .procname = "core_uses_pid", 4051da177e4SLinus Torvalds .data = &core_uses_pid, 4061da177e4SLinus Torvalds .maxlen = sizeof(int), 4071da177e4SLinus Torvalds .mode = 0644, 4086d456111SEric W. Biederman .proc_handler = proc_dointvec, 4091da177e4SLinus Torvalds }, 4101da177e4SLinus Torvalds { 4111da177e4SLinus Torvalds .procname = "core_pattern", 4121da177e4SLinus Torvalds .data = core_pattern, 41371ce92f3SDan Aloni .maxlen = CORENAME_MAX_SIZE, 4141da177e4SLinus Torvalds .mode = 0644, 4156d456111SEric W. Biederman .proc_handler = proc_dostring, 4161da177e4SLinus Torvalds }, 417a293980cSNeil Horman { 418a293980cSNeil Horman .procname = "core_pipe_limit", 419a293980cSNeil Horman .data = &core_pipe_limit, 420a293980cSNeil Horman .maxlen = sizeof(unsigned int), 421a293980cSNeil Horman .mode = 0644, 4226d456111SEric W. Biederman .proc_handler = proc_dointvec, 423a293980cSNeil Horman }, 42434f5a398STheodore Ts'o #ifdef CONFIG_PROC_SYSCTL 4251da177e4SLinus Torvalds { 4261da177e4SLinus Torvalds .procname = "tainted", 42725ddbb18SAndi Kleen .maxlen = sizeof(long), 42834f5a398STheodore Ts'o .mode = 0644, 4296d456111SEric W. Biederman .proc_handler = proc_taint, 4301da177e4SLinus Torvalds }, 43134f5a398STheodore Ts'o #endif 4329745512cSArjan van de Ven #ifdef CONFIG_LATENCYTOP 4339745512cSArjan van de Ven { 4349745512cSArjan van de Ven .procname = "latencytop", 4359745512cSArjan van de Ven .data = &latencytop_enabled, 4369745512cSArjan van de Ven .maxlen = sizeof(int), 4379745512cSArjan van de Ven .mode = 0644, 4386d456111SEric W. Biederman .proc_handler = proc_dointvec, 4399745512cSArjan van de Ven }, 4409745512cSArjan van de Ven #endif 4411da177e4SLinus Torvalds #ifdef CONFIG_BLK_DEV_INITRD 4421da177e4SLinus Torvalds { 4431da177e4SLinus Torvalds .procname = "real-root-dev", 4441da177e4SLinus Torvalds .data = &real_root_dev, 4451da177e4SLinus Torvalds .maxlen = sizeof(int), 4461da177e4SLinus Torvalds .mode = 0644, 4476d456111SEric W. Biederman .proc_handler = proc_dointvec, 4481da177e4SLinus Torvalds }, 4491da177e4SLinus Torvalds #endif 45045807a1dSIngo Molnar { 45145807a1dSIngo Molnar .procname = "print-fatal-signals", 45245807a1dSIngo Molnar .data = &print_fatal_signals, 45345807a1dSIngo Molnar .maxlen = sizeof(int), 45445807a1dSIngo Molnar .mode = 0644, 4556d456111SEric W. Biederman .proc_handler = proc_dointvec, 45645807a1dSIngo Molnar }, 45772c57ed5SDavid S. Miller #ifdef CONFIG_SPARC 4581da177e4SLinus Torvalds { 4591da177e4SLinus Torvalds .procname = "reboot-cmd", 4601da177e4SLinus Torvalds .data = reboot_command, 4611da177e4SLinus Torvalds .maxlen = 256, 4621da177e4SLinus Torvalds .mode = 0644, 4636d456111SEric W. Biederman .proc_handler = proc_dostring, 4641da177e4SLinus Torvalds }, 4651da177e4SLinus Torvalds { 4661da177e4SLinus Torvalds .procname = "stop-a", 4671da177e4SLinus Torvalds .data = &stop_a_enabled, 4681da177e4SLinus Torvalds .maxlen = sizeof (int), 4691da177e4SLinus Torvalds .mode = 0644, 4706d456111SEric W. Biederman .proc_handler = proc_dointvec, 4711da177e4SLinus Torvalds }, 4721da177e4SLinus Torvalds { 4731da177e4SLinus Torvalds .procname = "scons-poweroff", 4741da177e4SLinus Torvalds .data = &scons_pwroff, 4751da177e4SLinus Torvalds .maxlen = sizeof (int), 4761da177e4SLinus Torvalds .mode = 0644, 4776d456111SEric W. Biederman .proc_handler = proc_dointvec, 4781da177e4SLinus Torvalds }, 4791da177e4SLinus Torvalds #endif 4800871420fSDavid S. Miller #ifdef CONFIG_SPARC64 4810871420fSDavid S. Miller { 4820871420fSDavid S. Miller .procname = "tsb-ratio", 4830871420fSDavid S. Miller .data = &sysctl_tsb_ratio, 4840871420fSDavid S. Miller .maxlen = sizeof (int), 4850871420fSDavid S. Miller .mode = 0644, 4866d456111SEric W. Biederman .proc_handler = proc_dointvec, 4870871420fSDavid S. Miller }, 4880871420fSDavid S. Miller #endif 4891da177e4SLinus Torvalds #ifdef __hppa__ 4901da177e4SLinus Torvalds { 4911da177e4SLinus Torvalds .procname = "soft-power", 4921da177e4SLinus Torvalds .data = &pwrsw_enabled, 4931da177e4SLinus Torvalds .maxlen = sizeof (int), 4941da177e4SLinus Torvalds .mode = 0644, 4956d456111SEric W. Biederman .proc_handler = proc_dointvec, 4961da177e4SLinus Torvalds }, 4971da177e4SLinus Torvalds { 4981da177e4SLinus Torvalds .procname = "unaligned-trap", 4991da177e4SLinus Torvalds .data = &unaligned_enabled, 5001da177e4SLinus Torvalds .maxlen = sizeof (int), 5011da177e4SLinus Torvalds .mode = 0644, 5026d456111SEric W. Biederman .proc_handler = proc_dointvec, 5031da177e4SLinus Torvalds }, 5041da177e4SLinus Torvalds #endif 5051da177e4SLinus Torvalds { 5061da177e4SLinus Torvalds .procname = "ctrl-alt-del", 5071da177e4SLinus Torvalds .data = &C_A_D, 5081da177e4SLinus Torvalds .maxlen = sizeof(int), 5091da177e4SLinus Torvalds .mode = 0644, 5106d456111SEric W. Biederman .proc_handler = proc_dointvec, 5111da177e4SLinus Torvalds }, 512606576ceSSteven Rostedt #ifdef CONFIG_FUNCTION_TRACER 513b0fc494fSSteven Rostedt { 514b0fc494fSSteven Rostedt .procname = "ftrace_enabled", 515b0fc494fSSteven Rostedt .data = &ftrace_enabled, 516b0fc494fSSteven Rostedt .maxlen = sizeof(int), 517b0fc494fSSteven Rostedt .mode = 0644, 5186d456111SEric W. Biederman .proc_handler = ftrace_enable_sysctl, 519b0fc494fSSteven Rostedt }, 520b0fc494fSSteven Rostedt #endif 521f38f1d2aSSteven Rostedt #ifdef CONFIG_STACK_TRACER 522f38f1d2aSSteven Rostedt { 523f38f1d2aSSteven Rostedt .procname = "stack_tracer_enabled", 524f38f1d2aSSteven Rostedt .data = &stack_tracer_enabled, 525f38f1d2aSSteven Rostedt .maxlen = sizeof(int), 526f38f1d2aSSteven Rostedt .mode = 0644, 5276d456111SEric W. Biederman .proc_handler = stack_trace_sysctl, 528f38f1d2aSSteven Rostedt }, 529f38f1d2aSSteven Rostedt #endif 530944ac425SSteven Rostedt #ifdef CONFIG_TRACING 531944ac425SSteven Rostedt { 5323299b4ddSPeter Zijlstra .procname = "ftrace_dump_on_oops", 533944ac425SSteven Rostedt .data = &ftrace_dump_on_oops, 534944ac425SSteven Rostedt .maxlen = sizeof(int), 535944ac425SSteven Rostedt .mode = 0644, 5366d456111SEric W. Biederman .proc_handler = proc_dointvec, 537944ac425SSteven Rostedt }, 538944ac425SSteven Rostedt #endif 539a1ef5adbSJohannes Berg #ifdef CONFIG_MODULES 5401da177e4SLinus Torvalds { 5411da177e4SLinus Torvalds .procname = "modprobe", 5421da177e4SLinus Torvalds .data = &modprobe_path, 5431da177e4SLinus Torvalds .maxlen = KMOD_PATH_LEN, 5441da177e4SLinus Torvalds .mode = 0644, 5456d456111SEric W. Biederman .proc_handler = proc_dostring, 5461da177e4SLinus Torvalds }, 5473d43321bSKees Cook { 5483d43321bSKees Cook .procname = "modules_disabled", 5493d43321bSKees Cook .data = &modules_disabled, 5503d43321bSKees Cook .maxlen = sizeof(int), 5513d43321bSKees Cook .mode = 0644, 5523d43321bSKees Cook /* only handle a transition from default "0" to "1" */ 5536d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 5543d43321bSKees Cook .extra1 = &one, 5553d43321bSKees Cook .extra2 = &one, 5563d43321bSKees Cook }, 5571da177e4SLinus Torvalds #endif 55857ae2508SAndrew Morton #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 5591da177e4SLinus Torvalds { 5601da177e4SLinus Torvalds .procname = "hotplug", 561312c004dSKay Sievers .data = &uevent_helper, 562312c004dSKay Sievers .maxlen = UEVENT_HELPER_PATH_LEN, 5631da177e4SLinus Torvalds .mode = 0644, 5646d456111SEric W. Biederman .proc_handler = proc_dostring, 5651da177e4SLinus Torvalds }, 5661da177e4SLinus Torvalds #endif 5671da177e4SLinus Torvalds #ifdef CONFIG_CHR_DEV_SG 5681da177e4SLinus Torvalds { 5691da177e4SLinus Torvalds .procname = "sg-big-buff", 5701da177e4SLinus Torvalds .data = &sg_big_buff, 5711da177e4SLinus Torvalds .maxlen = sizeof (int), 5721da177e4SLinus Torvalds .mode = 0444, 5736d456111SEric W. Biederman .proc_handler = proc_dointvec, 5741da177e4SLinus Torvalds }, 5751da177e4SLinus Torvalds #endif 5761da177e4SLinus Torvalds #ifdef CONFIG_BSD_PROCESS_ACCT 5771da177e4SLinus Torvalds { 5781da177e4SLinus Torvalds .procname = "acct", 5791da177e4SLinus Torvalds .data = &acct_parm, 5801da177e4SLinus Torvalds .maxlen = 3*sizeof(int), 5811da177e4SLinus Torvalds .mode = 0644, 5826d456111SEric W. Biederman .proc_handler = proc_dointvec, 5831da177e4SLinus Torvalds }, 5841da177e4SLinus Torvalds #endif 5851da177e4SLinus Torvalds #ifdef CONFIG_MAGIC_SYSRQ 5861da177e4SLinus Torvalds { 5871da177e4SLinus Torvalds .procname = "sysrq", 5885d6f647fSIngo Molnar .data = &__sysrq_enabled, 5891da177e4SLinus Torvalds .maxlen = sizeof (int), 5901da177e4SLinus Torvalds .mode = 0644, 591*97f5f0cdSDmitry Torokhov .proc_handler = sysrq_sysctl_handler, 5921da177e4SLinus Torvalds }, 5931da177e4SLinus Torvalds #endif 594d6f8ff73SRandy Dunlap #ifdef CONFIG_PROC_SYSCTL 5951da177e4SLinus Torvalds { 5961da177e4SLinus Torvalds .procname = "cad_pid", 5979ec52099SCedric Le Goater .data = NULL, 5981da177e4SLinus Torvalds .maxlen = sizeof (int), 5991da177e4SLinus Torvalds .mode = 0600, 6006d456111SEric W. Biederman .proc_handler = proc_do_cad_pid, 6011da177e4SLinus Torvalds }, 602d6f8ff73SRandy Dunlap #endif 6031da177e4SLinus Torvalds { 6041da177e4SLinus Torvalds .procname = "threads-max", 6051da177e4SLinus Torvalds .data = &max_threads, 6061da177e4SLinus Torvalds .maxlen = sizeof(int), 6071da177e4SLinus Torvalds .mode = 0644, 6086d456111SEric W. Biederman .proc_handler = proc_dointvec, 6091da177e4SLinus Torvalds }, 6101da177e4SLinus Torvalds { 6111da177e4SLinus Torvalds .procname = "random", 6121da177e4SLinus Torvalds .mode = 0555, 6131da177e4SLinus Torvalds .child = random_table, 6141da177e4SLinus Torvalds }, 6151da177e4SLinus Torvalds { 6161da177e4SLinus Torvalds .procname = "overflowuid", 6171da177e4SLinus Torvalds .data = &overflowuid, 6181da177e4SLinus Torvalds .maxlen = sizeof(int), 6191da177e4SLinus Torvalds .mode = 0644, 6206d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6211da177e4SLinus Torvalds .extra1 = &minolduid, 6221da177e4SLinus Torvalds .extra2 = &maxolduid, 6231da177e4SLinus Torvalds }, 6241da177e4SLinus Torvalds { 6251da177e4SLinus Torvalds .procname = "overflowgid", 6261da177e4SLinus Torvalds .data = &overflowgid, 6271da177e4SLinus Torvalds .maxlen = sizeof(int), 6281da177e4SLinus Torvalds .mode = 0644, 6296d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6301da177e4SLinus Torvalds .extra1 = &minolduid, 6311da177e4SLinus Torvalds .extra2 = &maxolduid, 6321da177e4SLinus Torvalds }, 633347a8dc3SMartin Schwidefsky #ifdef CONFIG_S390 6341da177e4SLinus Torvalds #ifdef CONFIG_MATHEMU 6351da177e4SLinus Torvalds { 6361da177e4SLinus Torvalds .procname = "ieee_emulation_warnings", 6371da177e4SLinus Torvalds .data = &sysctl_ieee_emulation_warnings, 6381da177e4SLinus Torvalds .maxlen = sizeof(int), 6391da177e4SLinus Torvalds .mode = 0644, 6406d456111SEric W. Biederman .proc_handler = proc_dointvec, 6411da177e4SLinus Torvalds }, 6421da177e4SLinus Torvalds #endif 6431da177e4SLinus Torvalds { 6441da177e4SLinus Torvalds .procname = "userprocess_debug", 6451da177e4SLinus Torvalds .data = &sysctl_userprocess_debug, 6461da177e4SLinus Torvalds .maxlen = sizeof(int), 6471da177e4SLinus Torvalds .mode = 0644, 6486d456111SEric W. Biederman .proc_handler = proc_dointvec, 6491da177e4SLinus Torvalds }, 6501da177e4SLinus Torvalds #endif 6511da177e4SLinus Torvalds { 6521da177e4SLinus Torvalds .procname = "pid_max", 6531da177e4SLinus Torvalds .data = &pid_max, 6541da177e4SLinus Torvalds .maxlen = sizeof (int), 6551da177e4SLinus Torvalds .mode = 0644, 6566d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 6571da177e4SLinus Torvalds .extra1 = &pid_max_min, 6581da177e4SLinus Torvalds .extra2 = &pid_max_max, 6591da177e4SLinus Torvalds }, 6601da177e4SLinus Torvalds { 6611da177e4SLinus Torvalds .procname = "panic_on_oops", 6621da177e4SLinus Torvalds .data = &panic_on_oops, 6631da177e4SLinus Torvalds .maxlen = sizeof(int), 6641da177e4SLinus Torvalds .mode = 0644, 6656d456111SEric W. Biederman .proc_handler = proc_dointvec, 6661da177e4SLinus Torvalds }, 6677ef3d2fdSJoe Perches #if defined CONFIG_PRINTK 6687ef3d2fdSJoe Perches { 6697ef3d2fdSJoe Perches .procname = "printk", 6707ef3d2fdSJoe Perches .data = &console_loglevel, 6717ef3d2fdSJoe Perches .maxlen = 4*sizeof(int), 6727ef3d2fdSJoe Perches .mode = 0644, 6736d456111SEric W. Biederman .proc_handler = proc_dointvec, 6747ef3d2fdSJoe Perches }, 6751da177e4SLinus Torvalds { 6761da177e4SLinus Torvalds .procname = "printk_ratelimit", 677717115e1SDave Young .data = &printk_ratelimit_state.interval, 6781da177e4SLinus Torvalds .maxlen = sizeof(int), 6791da177e4SLinus Torvalds .mode = 0644, 6806d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 6811da177e4SLinus Torvalds }, 6821da177e4SLinus Torvalds { 6831da177e4SLinus Torvalds .procname = "printk_ratelimit_burst", 684717115e1SDave Young .data = &printk_ratelimit_state.burst, 6851da177e4SLinus Torvalds .maxlen = sizeof(int), 6861da177e4SLinus Torvalds .mode = 0644, 6876d456111SEric W. Biederman .proc_handler = proc_dointvec, 6881da177e4SLinus Torvalds }, 689af91322eSDave Young { 690af91322eSDave Young .procname = "printk_delay", 691af91322eSDave Young .data = &printk_delay_msec, 692af91322eSDave Young .maxlen = sizeof(int), 693af91322eSDave Young .mode = 0644, 6946d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 695af91322eSDave Young .extra1 = &zero, 696af91322eSDave Young .extra2 = &ten_thousand, 697af91322eSDave Young }, 6987ef3d2fdSJoe Perches #endif 6991da177e4SLinus Torvalds { 7001da177e4SLinus Torvalds .procname = "ngroups_max", 7011da177e4SLinus Torvalds .data = &ngroups_max, 7021da177e4SLinus Torvalds .maxlen = sizeof (int), 7031da177e4SLinus Torvalds .mode = 0444, 7046d456111SEric W. Biederman .proc_handler = proc_dointvec, 7051da177e4SLinus Torvalds }, 7061da177e4SLinus Torvalds #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 7071da177e4SLinus Torvalds { 7081da177e4SLinus Torvalds .procname = "unknown_nmi_panic", 7091da177e4SLinus Torvalds .data = &unknown_nmi_panic, 7101da177e4SLinus Torvalds .maxlen = sizeof (int), 7111da177e4SLinus Torvalds .mode = 0644, 7126d456111SEric W. Biederman .proc_handler = proc_dointvec, 7131da177e4SLinus Torvalds }, 714407984f1SDon Zickus { 715407984f1SDon Zickus .procname = "nmi_watchdog", 716407984f1SDon Zickus .data = &nmi_watchdog_enabled, 717407984f1SDon Zickus .maxlen = sizeof (int), 718407984f1SDon Zickus .mode = 0644, 7196d456111SEric W. Biederman .proc_handler = proc_nmi_enabled, 7201da177e4SLinus Torvalds }, 7211da177e4SLinus Torvalds #endif 7221da177e4SLinus Torvalds #if defined(CONFIG_X86) 7231da177e4SLinus Torvalds { 7248da5addaSDon Zickus .procname = "panic_on_unrecovered_nmi", 7258da5addaSDon Zickus .data = &panic_on_unrecovered_nmi, 7268da5addaSDon Zickus .maxlen = sizeof(int), 7278da5addaSDon Zickus .mode = 0644, 7286d456111SEric W. Biederman .proc_handler = proc_dointvec, 7298da5addaSDon Zickus }, 7308da5addaSDon Zickus { 7315211a242SKurt Garloff .procname = "panic_on_io_nmi", 7325211a242SKurt Garloff .data = &panic_on_io_nmi, 7335211a242SKurt Garloff .maxlen = sizeof(int), 7345211a242SKurt Garloff .mode = 0644, 7356d456111SEric W. Biederman .proc_handler = proc_dointvec, 7365211a242SKurt Garloff }, 7375211a242SKurt Garloff { 7381da177e4SLinus Torvalds .procname = "bootloader_type", 7391da177e4SLinus Torvalds .data = &bootloader_type, 7401da177e4SLinus Torvalds .maxlen = sizeof (int), 7411da177e4SLinus Torvalds .mode = 0444, 7426d456111SEric W. Biederman .proc_handler = proc_dointvec, 7431da177e4SLinus Torvalds }, 7440741f4d2SChuck Ebbert { 7455031296cSH. Peter Anvin .procname = "bootloader_version", 7465031296cSH. Peter Anvin .data = &bootloader_version, 7475031296cSH. Peter Anvin .maxlen = sizeof (int), 7485031296cSH. Peter Anvin .mode = 0444, 7496d456111SEric W. Biederman .proc_handler = proc_dointvec, 7505031296cSH. Peter Anvin }, 7515031296cSH. Peter Anvin { 7520741f4d2SChuck Ebbert .procname = "kstack_depth_to_print", 7530741f4d2SChuck Ebbert .data = &kstack_depth_to_print, 7540741f4d2SChuck Ebbert .maxlen = sizeof(int), 7550741f4d2SChuck Ebbert .mode = 0644, 7566d456111SEric W. Biederman .proc_handler = proc_dointvec, 7570741f4d2SChuck Ebbert }, 7586e7c4025SIngo Molnar { 7596e7c4025SIngo Molnar .procname = "io_delay_type", 7606e7c4025SIngo Molnar .data = &io_delay_type, 7616e7c4025SIngo Molnar .maxlen = sizeof(int), 7626e7c4025SIngo Molnar .mode = 0644, 7636d456111SEric W. Biederman .proc_handler = proc_dointvec, 7646e7c4025SIngo Molnar }, 7651da177e4SLinus Torvalds #endif 7667a9166e3SLuke Yang #if defined(CONFIG_MMU) 7671da177e4SLinus Torvalds { 7681da177e4SLinus Torvalds .procname = "randomize_va_space", 7691da177e4SLinus Torvalds .data = &randomize_va_space, 7701da177e4SLinus Torvalds .maxlen = sizeof(int), 7711da177e4SLinus Torvalds .mode = 0644, 7726d456111SEric W. Biederman .proc_handler = proc_dointvec, 7731da177e4SLinus Torvalds }, 7747a9166e3SLuke Yang #endif 7750152fb37SMartin Schwidefsky #if defined(CONFIG_S390) && defined(CONFIG_SMP) 776951f22d5SMartin Schwidefsky { 777951f22d5SMartin Schwidefsky .procname = "spin_retry", 778951f22d5SMartin Schwidefsky .data = &spin_retry, 779951f22d5SMartin Schwidefsky .maxlen = sizeof (int), 780951f22d5SMartin Schwidefsky .mode = 0644, 7816d456111SEric W. Biederman .proc_handler = proc_dointvec, 782951f22d5SMartin Schwidefsky }, 783951f22d5SMartin Schwidefsky #endif 784673d5b43SLen Brown #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 785c255d844SPavel Machek { 786c255d844SPavel Machek .procname = "acpi_video_flags", 78777afcf78SPavel Machek .data = &acpi_realmode_flags, 788c255d844SPavel Machek .maxlen = sizeof (unsigned long), 789c255d844SPavel Machek .mode = 0644, 7906d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 791c255d844SPavel Machek }, 792c255d844SPavel Machek #endif 793d2b176edSJes Sorensen #ifdef CONFIG_IA64 794d2b176edSJes Sorensen { 795d2b176edSJes Sorensen .procname = "ignore-unaligned-usertrap", 796d2b176edSJes Sorensen .data = &no_unaligned_warning, 797d2b176edSJes Sorensen .maxlen = sizeof (int), 798d2b176edSJes Sorensen .mode = 0644, 7996d456111SEric W. Biederman .proc_handler = proc_dointvec, 800d2b176edSJes Sorensen }, 80188fc241fSDoug Chapman { 80288fc241fSDoug Chapman .procname = "unaligned-dump-stack", 80388fc241fSDoug Chapman .data = &unaligned_dump_stack, 80488fc241fSDoug Chapman .maxlen = sizeof (int), 80588fc241fSDoug Chapman .mode = 0644, 8066d456111SEric W. Biederman .proc_handler = proc_dointvec, 80788fc241fSDoug Chapman }, 808d2b176edSJes Sorensen #endif 809c4f3b63fSRavikiran G Thirumalai #ifdef CONFIG_DETECT_SOFTLOCKUP 810c4f3b63fSRavikiran G Thirumalai { 8119c44bc03SIngo Molnar .procname = "softlockup_panic", 8129c44bc03SIngo Molnar .data = &softlockup_panic, 8139c44bc03SIngo Molnar .maxlen = sizeof(int), 8149c44bc03SIngo Molnar .mode = 0644, 8156d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 8169c44bc03SIngo Molnar .extra1 = &zero, 8179c44bc03SIngo Molnar .extra2 = &one, 8189c44bc03SIngo Molnar }, 8199c44bc03SIngo Molnar { 820c4f3b63fSRavikiran G Thirumalai .procname = "softlockup_thresh", 821c4f3b63fSRavikiran G Thirumalai .data = &softlockup_thresh, 8229383d967SDimitri Sivanich .maxlen = sizeof(int), 823c4f3b63fSRavikiran G Thirumalai .mode = 0644, 8246d456111SEric W. Biederman .proc_handler = proc_dosoftlockup_thresh, 8259383d967SDimitri Sivanich .extra1 = &neg_one, 826c4f3b63fSRavikiran G Thirumalai .extra2 = &sixty, 827c4f3b63fSRavikiran G Thirumalai }, 828e162b39aSMandeep Singh Baines #endif 829e162b39aSMandeep Singh Baines #ifdef CONFIG_DETECT_HUNG_TASK 830e162b39aSMandeep Singh Baines { 831e162b39aSMandeep Singh Baines .procname = "hung_task_panic", 832e162b39aSMandeep Singh Baines .data = &sysctl_hung_task_panic, 833e162b39aSMandeep Singh Baines .maxlen = sizeof(int), 834e162b39aSMandeep Singh Baines .mode = 0644, 8356d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 836e162b39aSMandeep Singh Baines .extra1 = &zero, 837e162b39aSMandeep Singh Baines .extra2 = &one, 838e162b39aSMandeep Singh Baines }, 83982a1fcb9SIngo Molnar { 84082a1fcb9SIngo Molnar .procname = "hung_task_check_count", 84182a1fcb9SIngo Molnar .data = &sysctl_hung_task_check_count, 84290739081SIngo Molnar .maxlen = sizeof(unsigned long), 84382a1fcb9SIngo Molnar .mode = 0644, 8446d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 84582a1fcb9SIngo Molnar }, 84682a1fcb9SIngo Molnar { 84782a1fcb9SIngo Molnar .procname = "hung_task_timeout_secs", 84882a1fcb9SIngo Molnar .data = &sysctl_hung_task_timeout_secs, 84990739081SIngo Molnar .maxlen = sizeof(unsigned long), 85082a1fcb9SIngo Molnar .mode = 0644, 8516d456111SEric W. Biederman .proc_handler = proc_dohung_task_timeout_secs, 85282a1fcb9SIngo Molnar }, 85382a1fcb9SIngo Molnar { 85482a1fcb9SIngo Molnar .procname = "hung_task_warnings", 85582a1fcb9SIngo Molnar .data = &sysctl_hung_task_warnings, 85690739081SIngo Molnar .maxlen = sizeof(unsigned long), 85782a1fcb9SIngo Molnar .mode = 0644, 8586d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 85982a1fcb9SIngo Molnar }, 860c4f3b63fSRavikiran G Thirumalai #endif 861bebfa101SAndi Kleen #ifdef CONFIG_COMPAT 862bebfa101SAndi Kleen { 863bebfa101SAndi Kleen .procname = "compat-log", 864bebfa101SAndi Kleen .data = &compat_log, 865bebfa101SAndi Kleen .maxlen = sizeof (int), 866bebfa101SAndi Kleen .mode = 0644, 8676d456111SEric W. Biederman .proc_handler = proc_dointvec, 868bebfa101SAndi Kleen }, 869bebfa101SAndi Kleen #endif 87023f78d4aSIngo Molnar #ifdef CONFIG_RT_MUTEXES 87123f78d4aSIngo Molnar { 87223f78d4aSIngo Molnar .procname = "max_lock_depth", 87323f78d4aSIngo Molnar .data = &max_lock_depth, 87423f78d4aSIngo Molnar .maxlen = sizeof(int), 87523f78d4aSIngo Molnar .mode = 0644, 8766d456111SEric W. Biederman .proc_handler = proc_dointvec, 87723f78d4aSIngo Molnar }, 87823f78d4aSIngo Molnar #endif 87910a0a8d4SJeremy Fitzhardinge { 88010a0a8d4SJeremy Fitzhardinge .procname = "poweroff_cmd", 88110a0a8d4SJeremy Fitzhardinge .data = &poweroff_cmd, 88210a0a8d4SJeremy Fitzhardinge .maxlen = POWEROFF_CMD_PATH_LEN, 88310a0a8d4SJeremy Fitzhardinge .mode = 0644, 8846d456111SEric W. Biederman .proc_handler = proc_dostring, 88510a0a8d4SJeremy Fitzhardinge }, 8860b77f5bfSDavid Howells #ifdef CONFIG_KEYS 8870b77f5bfSDavid Howells { 8880b77f5bfSDavid Howells .procname = "keys", 8890b77f5bfSDavid Howells .mode = 0555, 8900b77f5bfSDavid Howells .child = key_sysctls, 8910b77f5bfSDavid Howells }, 8920b77f5bfSDavid Howells #endif 89331a72bceSPaul E. McKenney #ifdef CONFIG_RCU_TORTURE_TEST 89431a72bceSPaul E. McKenney { 89531a72bceSPaul E. McKenney .procname = "rcutorture_runnable", 89631a72bceSPaul E. McKenney .data = &rcutorture_runnable, 89731a72bceSPaul E. McKenney .maxlen = sizeof(int), 89831a72bceSPaul E. McKenney .mode = 0644, 8996d456111SEric W. Biederman .proc_handler = proc_dointvec, 90031a72bceSPaul E. McKenney }, 90131a72bceSPaul E. McKenney #endif 90212e22c5eSDavid Howells #ifdef CONFIG_SLOW_WORK 90312e22c5eSDavid Howells { 90412e22c5eSDavid Howells .procname = "slow-work", 90512e22c5eSDavid Howells .mode = 0555, 90612e22c5eSDavid Howells .child = slow_work_sysctls, 90712e22c5eSDavid Howells }, 90812e22c5eSDavid Howells #endif 909cdd6c482SIngo Molnar #ifdef CONFIG_PERF_EVENTS 9101ccd1549SPeter Zijlstra { 911cdd6c482SIngo Molnar .procname = "perf_event_paranoid", 912cdd6c482SIngo Molnar .data = &sysctl_perf_event_paranoid, 913cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_paranoid), 9141ccd1549SPeter Zijlstra .mode = 0644, 9156d456111SEric W. Biederman .proc_handler = proc_dointvec, 9161ccd1549SPeter Zijlstra }, 917c5078f78SPeter Zijlstra { 918cdd6c482SIngo Molnar .procname = "perf_event_mlock_kb", 919cdd6c482SIngo Molnar .data = &sysctl_perf_event_mlock, 920cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_mlock), 921c5078f78SPeter Zijlstra .mode = 0644, 9226d456111SEric W. Biederman .proc_handler = proc_dointvec, 923c5078f78SPeter Zijlstra }, 924a78ac325SPeter Zijlstra { 925cdd6c482SIngo Molnar .procname = "perf_event_max_sample_rate", 926cdd6c482SIngo Molnar .data = &sysctl_perf_event_sample_rate, 927cdd6c482SIngo Molnar .maxlen = sizeof(sysctl_perf_event_sample_rate), 928a78ac325SPeter Zijlstra .mode = 0644, 9296d456111SEric W. Biederman .proc_handler = proc_dointvec, 930a78ac325SPeter Zijlstra }, 9311ccd1549SPeter Zijlstra #endif 932dfec072eSVegard Nossum #ifdef CONFIG_KMEMCHECK 933dfec072eSVegard Nossum { 934dfec072eSVegard Nossum .procname = "kmemcheck", 935dfec072eSVegard Nossum .data = &kmemcheck_enabled, 936dfec072eSVegard Nossum .maxlen = sizeof(int), 937dfec072eSVegard Nossum .mode = 0644, 9386d456111SEric W. Biederman .proc_handler = proc_dointvec, 939dfec072eSVegard Nossum }, 940dfec072eSVegard Nossum #endif 941cb684b5bSJens Axboe #ifdef CONFIG_BLOCK 9425e605b64SJens Axboe { 9435e605b64SJens Axboe .procname = "blk_iopoll", 9445e605b64SJens Axboe .data = &blk_iopoll_enabled, 9455e605b64SJens Axboe .maxlen = sizeof(int), 9465e605b64SJens Axboe .mode = 0644, 9476d456111SEric W. Biederman .proc_handler = proc_dointvec, 9485e605b64SJens Axboe }, 949cb684b5bSJens Axboe #endif 950ed2c12f3SAndrew Morton /* 951ed2c12f3SAndrew Morton * NOTE: do not add new entries to this table unless you have read 952ed2c12f3SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 953ed2c12f3SAndrew Morton */ 9546fce56ecSEric W. Biederman { } 9551da177e4SLinus Torvalds }; 9561da177e4SLinus Torvalds 957d8217f07SEric W. Biederman static struct ctl_table vm_table[] = { 9581da177e4SLinus Torvalds { 9591da177e4SLinus Torvalds .procname = "overcommit_memory", 9601da177e4SLinus Torvalds .data = &sysctl_overcommit_memory, 9611da177e4SLinus Torvalds .maxlen = sizeof(sysctl_overcommit_memory), 9621da177e4SLinus Torvalds .mode = 0644, 9636d456111SEric W. Biederman .proc_handler = proc_dointvec, 9641da177e4SLinus Torvalds }, 9651da177e4SLinus Torvalds { 966fadd8fbdSKAMEZAWA Hiroyuki .procname = "panic_on_oom", 967fadd8fbdSKAMEZAWA Hiroyuki .data = &sysctl_panic_on_oom, 968fadd8fbdSKAMEZAWA Hiroyuki .maxlen = sizeof(sysctl_panic_on_oom), 969fadd8fbdSKAMEZAWA Hiroyuki .mode = 0644, 9706d456111SEric W. Biederman .proc_handler = proc_dointvec, 971fadd8fbdSKAMEZAWA Hiroyuki }, 972fadd8fbdSKAMEZAWA Hiroyuki { 973fe071d7eSDavid Rientjes .procname = "oom_kill_allocating_task", 974fe071d7eSDavid Rientjes .data = &sysctl_oom_kill_allocating_task, 975fe071d7eSDavid Rientjes .maxlen = sizeof(sysctl_oom_kill_allocating_task), 976fe071d7eSDavid Rientjes .mode = 0644, 9776d456111SEric W. Biederman .proc_handler = proc_dointvec, 978fe071d7eSDavid Rientjes }, 979fe071d7eSDavid Rientjes { 980fef1bdd6SDavid Rientjes .procname = "oom_dump_tasks", 981fef1bdd6SDavid Rientjes .data = &sysctl_oom_dump_tasks, 982fef1bdd6SDavid Rientjes .maxlen = sizeof(sysctl_oom_dump_tasks), 983fef1bdd6SDavid Rientjes .mode = 0644, 9846d456111SEric W. Biederman .proc_handler = proc_dointvec, 985fef1bdd6SDavid Rientjes }, 986fef1bdd6SDavid Rientjes { 9871da177e4SLinus Torvalds .procname = "overcommit_ratio", 9881da177e4SLinus Torvalds .data = &sysctl_overcommit_ratio, 9891da177e4SLinus Torvalds .maxlen = sizeof(sysctl_overcommit_ratio), 9901da177e4SLinus Torvalds .mode = 0644, 9916d456111SEric W. Biederman .proc_handler = proc_dointvec, 9921da177e4SLinus Torvalds }, 9931da177e4SLinus Torvalds { 9941da177e4SLinus Torvalds .procname = "page-cluster", 9951da177e4SLinus Torvalds .data = &page_cluster, 9961da177e4SLinus Torvalds .maxlen = sizeof(int), 9971da177e4SLinus Torvalds .mode = 0644, 9986d456111SEric W. Biederman .proc_handler = proc_dointvec, 9991da177e4SLinus Torvalds }, 10001da177e4SLinus Torvalds { 10011da177e4SLinus Torvalds .procname = "dirty_background_ratio", 10021da177e4SLinus Torvalds .data = &dirty_background_ratio, 10031da177e4SLinus Torvalds .maxlen = sizeof(dirty_background_ratio), 10041da177e4SLinus Torvalds .mode = 0644, 10056d456111SEric W. Biederman .proc_handler = dirty_background_ratio_handler, 10061da177e4SLinus Torvalds .extra1 = &zero, 10071da177e4SLinus Torvalds .extra2 = &one_hundred, 10081da177e4SLinus Torvalds }, 10091da177e4SLinus Torvalds { 10102da02997SDavid Rientjes .procname = "dirty_background_bytes", 10112da02997SDavid Rientjes .data = &dirty_background_bytes, 10122da02997SDavid Rientjes .maxlen = sizeof(dirty_background_bytes), 10132da02997SDavid Rientjes .mode = 0644, 10146d456111SEric W. Biederman .proc_handler = dirty_background_bytes_handler, 1015fc3501d4SSven Wegener .extra1 = &one_ul, 10162da02997SDavid Rientjes }, 10172da02997SDavid Rientjes { 10181da177e4SLinus Torvalds .procname = "dirty_ratio", 10191da177e4SLinus Torvalds .data = &vm_dirty_ratio, 10201da177e4SLinus Torvalds .maxlen = sizeof(vm_dirty_ratio), 10211da177e4SLinus Torvalds .mode = 0644, 10226d456111SEric W. Biederman .proc_handler = dirty_ratio_handler, 10231da177e4SLinus Torvalds .extra1 = &zero, 10241da177e4SLinus Torvalds .extra2 = &one_hundred, 10251da177e4SLinus Torvalds }, 10261da177e4SLinus Torvalds { 10272da02997SDavid Rientjes .procname = "dirty_bytes", 10282da02997SDavid Rientjes .data = &vm_dirty_bytes, 10292da02997SDavid Rientjes .maxlen = sizeof(vm_dirty_bytes), 10302da02997SDavid Rientjes .mode = 0644, 10316d456111SEric W. Biederman .proc_handler = dirty_bytes_handler, 10329e4a5bdaSAndrea Righi .extra1 = &dirty_bytes_min, 10332da02997SDavid Rientjes }, 10342da02997SDavid Rientjes { 10351da177e4SLinus Torvalds .procname = "dirty_writeback_centisecs", 1036f6ef9438SBart Samwel .data = &dirty_writeback_interval, 1037f6ef9438SBart Samwel .maxlen = sizeof(dirty_writeback_interval), 10381da177e4SLinus Torvalds .mode = 0644, 10396d456111SEric W. Biederman .proc_handler = dirty_writeback_centisecs_handler, 10401da177e4SLinus Torvalds }, 10411da177e4SLinus Torvalds { 10421da177e4SLinus Torvalds .procname = "dirty_expire_centisecs", 1043f6ef9438SBart Samwel .data = &dirty_expire_interval, 1044f6ef9438SBart Samwel .maxlen = sizeof(dirty_expire_interval), 10451da177e4SLinus Torvalds .mode = 0644, 10466d456111SEric W. Biederman .proc_handler = proc_dointvec, 10471da177e4SLinus Torvalds }, 10481da177e4SLinus Torvalds { 10491da177e4SLinus Torvalds .procname = "nr_pdflush_threads", 10501da177e4SLinus Torvalds .data = &nr_pdflush_threads, 10511da177e4SLinus Torvalds .maxlen = sizeof nr_pdflush_threads, 10521da177e4SLinus Torvalds .mode = 0444 /* read-only*/, 10536d456111SEric W. Biederman .proc_handler = proc_dointvec, 10541da177e4SLinus Torvalds }, 10551da177e4SLinus Torvalds { 10561da177e4SLinus Torvalds .procname = "swappiness", 10571da177e4SLinus Torvalds .data = &vm_swappiness, 10581da177e4SLinus Torvalds .maxlen = sizeof(vm_swappiness), 10591da177e4SLinus Torvalds .mode = 0644, 10606d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 10611da177e4SLinus Torvalds .extra1 = &zero, 10621da177e4SLinus Torvalds .extra2 = &one_hundred, 10631da177e4SLinus Torvalds }, 10641da177e4SLinus Torvalds #ifdef CONFIG_HUGETLB_PAGE 10651da177e4SLinus Torvalds { 10661da177e4SLinus Torvalds .procname = "nr_hugepages", 1067e5ff2159SAndi Kleen .data = NULL, 10681da177e4SLinus Torvalds .maxlen = sizeof(unsigned long), 10691da177e4SLinus Torvalds .mode = 0644, 10706d456111SEric W. Biederman .proc_handler = hugetlb_sysctl_handler, 10711da177e4SLinus Torvalds .extra1 = (void *)&hugetlb_zero, 10721da177e4SLinus Torvalds .extra2 = (void *)&hugetlb_infinity, 10731da177e4SLinus Torvalds }, 107406808b08SLee Schermerhorn #ifdef CONFIG_NUMA 107506808b08SLee Schermerhorn { 107606808b08SLee Schermerhorn .procname = "nr_hugepages_mempolicy", 107706808b08SLee Schermerhorn .data = NULL, 107806808b08SLee Schermerhorn .maxlen = sizeof(unsigned long), 107906808b08SLee Schermerhorn .mode = 0644, 108006808b08SLee Schermerhorn .proc_handler = &hugetlb_mempolicy_sysctl_handler, 108106808b08SLee Schermerhorn .extra1 = (void *)&hugetlb_zero, 108206808b08SLee Schermerhorn .extra2 = (void *)&hugetlb_infinity, 108306808b08SLee Schermerhorn }, 108406808b08SLee Schermerhorn #endif 10851da177e4SLinus Torvalds { 10861da177e4SLinus Torvalds .procname = "hugetlb_shm_group", 10871da177e4SLinus Torvalds .data = &sysctl_hugetlb_shm_group, 10881da177e4SLinus Torvalds .maxlen = sizeof(gid_t), 10891da177e4SLinus Torvalds .mode = 0644, 10906d456111SEric W. Biederman .proc_handler = proc_dointvec, 10911da177e4SLinus Torvalds }, 1092396faf03SMel Gorman { 1093396faf03SMel Gorman .procname = "hugepages_treat_as_movable", 1094396faf03SMel Gorman .data = &hugepages_treat_as_movable, 1095396faf03SMel Gorman .maxlen = sizeof(int), 1096396faf03SMel Gorman .mode = 0644, 10976d456111SEric W. Biederman .proc_handler = hugetlb_treat_movable_handler, 1098396faf03SMel Gorman }, 109954f9f80dSAdam Litke { 1100d1c3fb1fSNishanth Aravamudan .procname = "nr_overcommit_hugepages", 1101e5ff2159SAndi Kleen .data = NULL, 1102e5ff2159SAndi Kleen .maxlen = sizeof(unsigned long), 1103d1c3fb1fSNishanth Aravamudan .mode = 0644, 11046d456111SEric W. Biederman .proc_handler = hugetlb_overcommit_handler, 1105e5ff2159SAndi Kleen .extra1 = (void *)&hugetlb_zero, 1106e5ff2159SAndi Kleen .extra2 = (void *)&hugetlb_infinity, 1107d1c3fb1fSNishanth Aravamudan }, 11081da177e4SLinus Torvalds #endif 11091da177e4SLinus Torvalds { 11101da177e4SLinus Torvalds .procname = "lowmem_reserve_ratio", 11111da177e4SLinus Torvalds .data = &sysctl_lowmem_reserve_ratio, 11121da177e4SLinus Torvalds .maxlen = sizeof(sysctl_lowmem_reserve_ratio), 11131da177e4SLinus Torvalds .mode = 0644, 11146d456111SEric W. Biederman .proc_handler = lowmem_reserve_ratio_sysctl_handler, 11151da177e4SLinus Torvalds }, 11161da177e4SLinus Torvalds { 11179d0243bcSAndrew Morton .procname = "drop_caches", 11189d0243bcSAndrew Morton .data = &sysctl_drop_caches, 11199d0243bcSAndrew Morton .maxlen = sizeof(int), 11209d0243bcSAndrew Morton .mode = 0644, 11219d0243bcSAndrew Morton .proc_handler = drop_caches_sysctl_handler, 11229d0243bcSAndrew Morton }, 11239d0243bcSAndrew Morton { 11241da177e4SLinus Torvalds .procname = "min_free_kbytes", 11251da177e4SLinus Torvalds .data = &min_free_kbytes, 11261da177e4SLinus Torvalds .maxlen = sizeof(min_free_kbytes), 11271da177e4SLinus Torvalds .mode = 0644, 11286d456111SEric W. Biederman .proc_handler = min_free_kbytes_sysctl_handler, 11291da177e4SLinus Torvalds .extra1 = &zero, 11301da177e4SLinus Torvalds }, 11318ad4b1fbSRohit Seth { 11328ad4b1fbSRohit Seth .procname = "percpu_pagelist_fraction", 11338ad4b1fbSRohit Seth .data = &percpu_pagelist_fraction, 11348ad4b1fbSRohit Seth .maxlen = sizeof(percpu_pagelist_fraction), 11358ad4b1fbSRohit Seth .mode = 0644, 11366d456111SEric W. Biederman .proc_handler = percpu_pagelist_fraction_sysctl_handler, 11378ad4b1fbSRohit Seth .extra1 = &min_percpu_pagelist_fract, 11388ad4b1fbSRohit Seth }, 11391da177e4SLinus Torvalds #ifdef CONFIG_MMU 11401da177e4SLinus Torvalds { 11411da177e4SLinus Torvalds .procname = "max_map_count", 11421da177e4SLinus Torvalds .data = &sysctl_max_map_count, 11431da177e4SLinus Torvalds .maxlen = sizeof(sysctl_max_map_count), 11441da177e4SLinus Torvalds .mode = 0644, 11453e26120cSWANG Cong .proc_handler = proc_dointvec_minmax, 114670da2340SAmerigo Wang .extra1 = &zero, 11471da177e4SLinus Torvalds }, 1148dd8632a1SPaul Mundt #else 1149dd8632a1SPaul Mundt { 1150dd8632a1SPaul Mundt .procname = "nr_trim_pages", 1151dd8632a1SPaul Mundt .data = &sysctl_nr_trim_pages, 1152dd8632a1SPaul Mundt .maxlen = sizeof(sysctl_nr_trim_pages), 1153dd8632a1SPaul Mundt .mode = 0644, 11546d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1155dd8632a1SPaul Mundt .extra1 = &zero, 1156dd8632a1SPaul Mundt }, 11571da177e4SLinus Torvalds #endif 11581da177e4SLinus Torvalds { 11591da177e4SLinus Torvalds .procname = "laptop_mode", 11601da177e4SLinus Torvalds .data = &laptop_mode, 11611da177e4SLinus Torvalds .maxlen = sizeof(laptop_mode), 11621da177e4SLinus Torvalds .mode = 0644, 11636d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 11641da177e4SLinus Torvalds }, 11651da177e4SLinus Torvalds { 11661da177e4SLinus Torvalds .procname = "block_dump", 11671da177e4SLinus Torvalds .data = &block_dump, 11681da177e4SLinus Torvalds .maxlen = sizeof(block_dump), 11691da177e4SLinus Torvalds .mode = 0644, 11706d456111SEric W. Biederman .proc_handler = proc_dointvec, 11711da177e4SLinus Torvalds .extra1 = &zero, 11721da177e4SLinus Torvalds }, 11731da177e4SLinus Torvalds { 11741da177e4SLinus Torvalds .procname = "vfs_cache_pressure", 11751da177e4SLinus Torvalds .data = &sysctl_vfs_cache_pressure, 11761da177e4SLinus Torvalds .maxlen = sizeof(sysctl_vfs_cache_pressure), 11771da177e4SLinus Torvalds .mode = 0644, 11786d456111SEric W. Biederman .proc_handler = proc_dointvec, 11791da177e4SLinus Torvalds .extra1 = &zero, 11801da177e4SLinus Torvalds }, 11811da177e4SLinus Torvalds #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 11821da177e4SLinus Torvalds { 11831da177e4SLinus Torvalds .procname = "legacy_va_layout", 11841da177e4SLinus Torvalds .data = &sysctl_legacy_va_layout, 11851da177e4SLinus Torvalds .maxlen = sizeof(sysctl_legacy_va_layout), 11861da177e4SLinus Torvalds .mode = 0644, 11876d456111SEric W. Biederman .proc_handler = proc_dointvec, 11881da177e4SLinus Torvalds .extra1 = &zero, 11891da177e4SLinus Torvalds }, 11901da177e4SLinus Torvalds #endif 11911743660bSChristoph Lameter #ifdef CONFIG_NUMA 11921743660bSChristoph Lameter { 11931743660bSChristoph Lameter .procname = "zone_reclaim_mode", 11941743660bSChristoph Lameter .data = &zone_reclaim_mode, 11951743660bSChristoph Lameter .maxlen = sizeof(zone_reclaim_mode), 11961743660bSChristoph Lameter .mode = 0644, 11976d456111SEric W. Biederman .proc_handler = proc_dointvec, 1198c84db23cSChristoph Lameter .extra1 = &zero, 11991743660bSChristoph Lameter }, 12009614634fSChristoph Lameter { 12019614634fSChristoph Lameter .procname = "min_unmapped_ratio", 12029614634fSChristoph Lameter .data = &sysctl_min_unmapped_ratio, 12039614634fSChristoph Lameter .maxlen = sizeof(sysctl_min_unmapped_ratio), 12049614634fSChristoph Lameter .mode = 0644, 12056d456111SEric W. Biederman .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, 12069614634fSChristoph Lameter .extra1 = &zero, 12079614634fSChristoph Lameter .extra2 = &one_hundred, 12089614634fSChristoph Lameter }, 12090ff38490SChristoph Lameter { 12100ff38490SChristoph Lameter .procname = "min_slab_ratio", 12110ff38490SChristoph Lameter .data = &sysctl_min_slab_ratio, 12120ff38490SChristoph Lameter .maxlen = sizeof(sysctl_min_slab_ratio), 12130ff38490SChristoph Lameter .mode = 0644, 12146d456111SEric W. Biederman .proc_handler = sysctl_min_slab_ratio_sysctl_handler, 12150ff38490SChristoph Lameter .extra1 = &zero, 12160ff38490SChristoph Lameter .extra2 = &one_hundred, 12170ff38490SChristoph Lameter }, 12181743660bSChristoph Lameter #endif 121977461ab3SChristoph Lameter #ifdef CONFIG_SMP 122077461ab3SChristoph Lameter { 122177461ab3SChristoph Lameter .procname = "stat_interval", 122277461ab3SChristoph Lameter .data = &sysctl_stat_interval, 122377461ab3SChristoph Lameter .maxlen = sizeof(sysctl_stat_interval), 122477461ab3SChristoph Lameter .mode = 0644, 12256d456111SEric W. Biederman .proc_handler = proc_dointvec_jiffies, 122677461ab3SChristoph Lameter }, 122777461ab3SChristoph Lameter #endif 12286e141546SDavid Howells #ifdef CONFIG_MMU 1229ed032189SEric Paris { 1230ed032189SEric Paris .procname = "mmap_min_addr", 1231788084abSEric Paris .data = &dac_mmap_min_addr, 1232ed032189SEric Paris .maxlen = sizeof(unsigned long), 1233ed032189SEric Paris .mode = 0644, 12346d456111SEric W. Biederman .proc_handler = mmap_min_addr_handler, 1235ed032189SEric Paris }, 12366e141546SDavid Howells #endif 1237f0c0b2b8SKAMEZAWA Hiroyuki #ifdef CONFIG_NUMA 1238f0c0b2b8SKAMEZAWA Hiroyuki { 1239f0c0b2b8SKAMEZAWA Hiroyuki .procname = "numa_zonelist_order", 1240f0c0b2b8SKAMEZAWA Hiroyuki .data = &numa_zonelist_order, 1241f0c0b2b8SKAMEZAWA Hiroyuki .maxlen = NUMA_ZONELIST_ORDER_LEN, 1242f0c0b2b8SKAMEZAWA Hiroyuki .mode = 0644, 12436d456111SEric W. Biederman .proc_handler = numa_zonelist_order_handler, 1244f0c0b2b8SKAMEZAWA Hiroyuki }, 1245f0c0b2b8SKAMEZAWA Hiroyuki #endif 12462b8232ceSAl Viro #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ 12475c36e657SPaul Mundt (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1248e6e5494cSIngo Molnar { 1249e6e5494cSIngo Molnar .procname = "vdso_enabled", 1250e6e5494cSIngo Molnar .data = &vdso_enabled, 1251e6e5494cSIngo Molnar .maxlen = sizeof(vdso_enabled), 1252e6e5494cSIngo Molnar .mode = 0644, 12536d456111SEric W. Biederman .proc_handler = proc_dointvec, 1254e6e5494cSIngo Molnar .extra1 = &zero, 1255e6e5494cSIngo Molnar }, 1256e6e5494cSIngo Molnar #endif 1257195cf453SBron Gondwana #ifdef CONFIG_HIGHMEM 1258195cf453SBron Gondwana { 1259195cf453SBron Gondwana .procname = "highmem_is_dirtyable", 1260195cf453SBron Gondwana .data = &vm_highmem_is_dirtyable, 1261195cf453SBron Gondwana .maxlen = sizeof(vm_highmem_is_dirtyable), 1262195cf453SBron Gondwana .mode = 0644, 12636d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1264195cf453SBron Gondwana .extra1 = &zero, 1265195cf453SBron Gondwana .extra2 = &one, 1266195cf453SBron Gondwana }, 1267195cf453SBron Gondwana #endif 12684be6f6bbSPeter Zijlstra { 12694be6f6bbSPeter Zijlstra .procname = "scan_unevictable_pages", 12704be6f6bbSPeter Zijlstra .data = &scan_unevictable_pages, 12714be6f6bbSPeter Zijlstra .maxlen = sizeof(scan_unevictable_pages), 12724be6f6bbSPeter Zijlstra .mode = 0644, 12736d456111SEric W. Biederman .proc_handler = scan_unevictable_handler, 12744be6f6bbSPeter Zijlstra }, 12756a46079cSAndi Kleen #ifdef CONFIG_MEMORY_FAILURE 12766a46079cSAndi Kleen { 12776a46079cSAndi Kleen .procname = "memory_failure_early_kill", 12786a46079cSAndi Kleen .data = &sysctl_memory_failure_early_kill, 12796a46079cSAndi Kleen .maxlen = sizeof(sysctl_memory_failure_early_kill), 12806a46079cSAndi Kleen .mode = 0644, 12816d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 12826a46079cSAndi Kleen .extra1 = &zero, 12836a46079cSAndi Kleen .extra2 = &one, 12846a46079cSAndi Kleen }, 12856a46079cSAndi Kleen { 12866a46079cSAndi Kleen .procname = "memory_failure_recovery", 12876a46079cSAndi Kleen .data = &sysctl_memory_failure_recovery, 12886a46079cSAndi Kleen .maxlen = sizeof(sysctl_memory_failure_recovery), 12896a46079cSAndi Kleen .mode = 0644, 12906d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 12916a46079cSAndi Kleen .extra1 = &zero, 12926a46079cSAndi Kleen .extra2 = &one, 12936a46079cSAndi Kleen }, 12946a46079cSAndi Kleen #endif 12956a46079cSAndi Kleen 12962be7fe07SAndrew Morton /* 12972be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 12982be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 12992be7fe07SAndrew Morton */ 13006fce56ecSEric W. Biederman { } 13011da177e4SLinus Torvalds }; 13021da177e4SLinus Torvalds 13032abc26fcSEric W. Biederman #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1304d8217f07SEric W. Biederman static struct ctl_table binfmt_misc_table[] = { 13056fce56ecSEric W. Biederman { } 13062abc26fcSEric W. Biederman }; 13072abc26fcSEric W. Biederman #endif 13082abc26fcSEric W. Biederman 1309d8217f07SEric W. Biederman static struct ctl_table fs_table[] = { 13101da177e4SLinus Torvalds { 13111da177e4SLinus Torvalds .procname = "inode-nr", 13121da177e4SLinus Torvalds .data = &inodes_stat, 13131da177e4SLinus Torvalds .maxlen = 2*sizeof(int), 13141da177e4SLinus Torvalds .mode = 0444, 13156d456111SEric W. Biederman .proc_handler = proc_dointvec, 13161da177e4SLinus Torvalds }, 13171da177e4SLinus Torvalds { 13181da177e4SLinus Torvalds .procname = "inode-state", 13191da177e4SLinus Torvalds .data = &inodes_stat, 13201da177e4SLinus Torvalds .maxlen = 7*sizeof(int), 13211da177e4SLinus Torvalds .mode = 0444, 13226d456111SEric W. Biederman .proc_handler = proc_dointvec, 13231da177e4SLinus Torvalds }, 13241da177e4SLinus Torvalds { 13251da177e4SLinus Torvalds .procname = "file-nr", 13261da177e4SLinus Torvalds .data = &files_stat, 13271da177e4SLinus Torvalds .maxlen = 3*sizeof(int), 13281da177e4SLinus Torvalds .mode = 0444, 13296d456111SEric W. Biederman .proc_handler = proc_nr_files, 13301da177e4SLinus Torvalds }, 13311da177e4SLinus Torvalds { 13321da177e4SLinus Torvalds .procname = "file-max", 13331da177e4SLinus Torvalds .data = &files_stat.max_files, 13341da177e4SLinus Torvalds .maxlen = sizeof(int), 13351da177e4SLinus Torvalds .mode = 0644, 13366d456111SEric W. Biederman .proc_handler = proc_dointvec, 13371da177e4SLinus Torvalds }, 13381da177e4SLinus Torvalds { 13399cfe015aSEric Dumazet .procname = "nr_open", 13409cfe015aSEric Dumazet .data = &sysctl_nr_open, 13419cfe015aSEric Dumazet .maxlen = sizeof(int), 13429cfe015aSEric Dumazet .mode = 0644, 13436d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 1344eceea0b3SAl Viro .extra1 = &sysctl_nr_open_min, 1345eceea0b3SAl Viro .extra2 = &sysctl_nr_open_max, 13469cfe015aSEric Dumazet }, 13479cfe015aSEric Dumazet { 13481da177e4SLinus Torvalds .procname = "dentry-state", 13491da177e4SLinus Torvalds .data = &dentry_stat, 13501da177e4SLinus Torvalds .maxlen = 6*sizeof(int), 13511da177e4SLinus Torvalds .mode = 0444, 13526d456111SEric W. Biederman .proc_handler = proc_dointvec, 13531da177e4SLinus Torvalds }, 13541da177e4SLinus Torvalds { 13551da177e4SLinus Torvalds .procname = "overflowuid", 13561da177e4SLinus Torvalds .data = &fs_overflowuid, 13571da177e4SLinus Torvalds .maxlen = sizeof(int), 13581da177e4SLinus Torvalds .mode = 0644, 13596d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 13601da177e4SLinus Torvalds .extra1 = &minolduid, 13611da177e4SLinus Torvalds .extra2 = &maxolduid, 13621da177e4SLinus Torvalds }, 13631da177e4SLinus Torvalds { 13641da177e4SLinus Torvalds .procname = "overflowgid", 13651da177e4SLinus Torvalds .data = &fs_overflowgid, 13661da177e4SLinus Torvalds .maxlen = sizeof(int), 13671da177e4SLinus Torvalds .mode = 0644, 13686d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 13691da177e4SLinus Torvalds .extra1 = &minolduid, 13701da177e4SLinus Torvalds .extra2 = &maxolduid, 13711da177e4SLinus Torvalds }, 1372bfcd17a6SThomas Petazzoni #ifdef CONFIG_FILE_LOCKING 13731da177e4SLinus Torvalds { 13741da177e4SLinus Torvalds .procname = "leases-enable", 13751da177e4SLinus Torvalds .data = &leases_enable, 13761da177e4SLinus Torvalds .maxlen = sizeof(int), 13771da177e4SLinus Torvalds .mode = 0644, 13786d456111SEric W. Biederman .proc_handler = proc_dointvec, 13791da177e4SLinus Torvalds }, 1380bfcd17a6SThomas Petazzoni #endif 13811da177e4SLinus Torvalds #ifdef CONFIG_DNOTIFY 13821da177e4SLinus Torvalds { 13831da177e4SLinus Torvalds .procname = "dir-notify-enable", 13841da177e4SLinus Torvalds .data = &dir_notify_enable, 13851da177e4SLinus Torvalds .maxlen = sizeof(int), 13861da177e4SLinus Torvalds .mode = 0644, 13876d456111SEric W. Biederman .proc_handler = proc_dointvec, 13881da177e4SLinus Torvalds }, 13891da177e4SLinus Torvalds #endif 13901da177e4SLinus Torvalds #ifdef CONFIG_MMU 1391bfcd17a6SThomas Petazzoni #ifdef CONFIG_FILE_LOCKING 13921da177e4SLinus Torvalds { 13931da177e4SLinus Torvalds .procname = "lease-break-time", 13941da177e4SLinus Torvalds .data = &lease_break_time, 13951da177e4SLinus Torvalds .maxlen = sizeof(int), 13961da177e4SLinus Torvalds .mode = 0644, 13976d456111SEric W. Biederman .proc_handler = proc_dointvec, 13981da177e4SLinus Torvalds }, 1399bfcd17a6SThomas Petazzoni #endif 1400ebf3f09cSThomas Petazzoni #ifdef CONFIG_AIO 14011da177e4SLinus Torvalds { 14021da177e4SLinus Torvalds .procname = "aio-nr", 14031da177e4SLinus Torvalds .data = &aio_nr, 14041da177e4SLinus Torvalds .maxlen = sizeof(aio_nr), 14051da177e4SLinus Torvalds .mode = 0444, 14066d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 14071da177e4SLinus Torvalds }, 14081da177e4SLinus Torvalds { 14091da177e4SLinus Torvalds .procname = "aio-max-nr", 14101da177e4SLinus Torvalds .data = &aio_max_nr, 14111da177e4SLinus Torvalds .maxlen = sizeof(aio_max_nr), 14121da177e4SLinus Torvalds .mode = 0644, 14136d456111SEric W. Biederman .proc_handler = proc_doulongvec_minmax, 14141da177e4SLinus Torvalds }, 1415ebf3f09cSThomas Petazzoni #endif /* CONFIG_AIO */ 14162d9048e2SAmy Griffis #ifdef CONFIG_INOTIFY_USER 14170399cb08SRobert Love { 14180399cb08SRobert Love .procname = "inotify", 14190399cb08SRobert Love .mode = 0555, 14200399cb08SRobert Love .child = inotify_table, 14210399cb08SRobert Love }, 14220399cb08SRobert Love #endif 14237ef9964eSDavide Libenzi #ifdef CONFIG_EPOLL 14247ef9964eSDavide Libenzi { 14257ef9964eSDavide Libenzi .procname = "epoll", 14267ef9964eSDavide Libenzi .mode = 0555, 14277ef9964eSDavide Libenzi .child = epoll_table, 14287ef9964eSDavide Libenzi }, 14297ef9964eSDavide Libenzi #endif 14301da177e4SLinus Torvalds #endif 1431d6e71144SAlan Cox { 1432d6e71144SAlan Cox .procname = "suid_dumpable", 1433d6e71144SAlan Cox .data = &suid_dumpable, 1434d6e71144SAlan Cox .maxlen = sizeof(int), 1435d6e71144SAlan Cox .mode = 0644, 14366d456111SEric W. Biederman .proc_handler = proc_dointvec_minmax, 14378e654fbaSMatthew Wilcox .extra1 = &zero, 14388e654fbaSMatthew Wilcox .extra2 = &two, 1439d6e71144SAlan Cox }, 14402abc26fcSEric W. Biederman #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 14412abc26fcSEric W. Biederman { 14422abc26fcSEric W. Biederman .procname = "binfmt_misc", 14432abc26fcSEric W. Biederman .mode = 0555, 14442abc26fcSEric W. Biederman .child = binfmt_misc_table, 14452abc26fcSEric W. Biederman }, 14462abc26fcSEric W. Biederman #endif 14472be7fe07SAndrew Morton /* 14482be7fe07SAndrew Morton * NOTE: do not add new entries to this table unless you have read 14492be7fe07SAndrew Morton * Documentation/sysctl/ctl_unnumbered.txt 14502be7fe07SAndrew Morton */ 14516fce56ecSEric W. Biederman { } 14521da177e4SLinus Torvalds }; 14531da177e4SLinus Torvalds 1454d8217f07SEric W. Biederman static struct ctl_table debug_table[] = { 14554b177647SDavid S. Miller #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) 1456abd4f750SMasoud Asgharifard Sharbiani { 1457abd4f750SMasoud Asgharifard Sharbiani .procname = "exception-trace", 1458abd4f750SMasoud Asgharifard Sharbiani .data = &show_unhandled_signals, 1459abd4f750SMasoud Asgharifard Sharbiani .maxlen = sizeof(int), 1460abd4f750SMasoud Asgharifard Sharbiani .mode = 0644, 1461abd4f750SMasoud Asgharifard Sharbiani .proc_handler = proc_dointvec 1462abd4f750SMasoud Asgharifard Sharbiani }, 1463abd4f750SMasoud Asgharifard Sharbiani #endif 1464b2be84dfSMasami Hiramatsu #if defined(CONFIG_OPTPROBES) 1465b2be84dfSMasami Hiramatsu { 1466b2be84dfSMasami Hiramatsu .procname = "kprobes-optimization", 1467b2be84dfSMasami Hiramatsu .data = &sysctl_kprobes_optimization, 1468b2be84dfSMasami Hiramatsu .maxlen = sizeof(int), 1469b2be84dfSMasami Hiramatsu .mode = 0644, 1470b2be84dfSMasami Hiramatsu .proc_handler = proc_kprobes_optimization_handler, 1471b2be84dfSMasami Hiramatsu .extra1 = &zero, 1472b2be84dfSMasami Hiramatsu .extra2 = &one, 1473b2be84dfSMasami Hiramatsu }, 1474b2be84dfSMasami Hiramatsu #endif 14756fce56ecSEric W. Biederman { } 14761da177e4SLinus Torvalds }; 14771da177e4SLinus Torvalds 1478d8217f07SEric W. Biederman static struct ctl_table dev_table[] = { 14796fce56ecSEric W. Biederman { } 14801da177e4SLinus Torvalds }; 14811da177e4SLinus Torvalds 1482330d57fbSAl Viro static DEFINE_SPINLOCK(sysctl_lock); 1483330d57fbSAl Viro 1484330d57fbSAl Viro /* called under sysctl_lock */ 1485330d57fbSAl Viro static int use_table(struct ctl_table_header *p) 1486330d57fbSAl Viro { 1487330d57fbSAl Viro if (unlikely(p->unregistering)) 1488330d57fbSAl Viro return 0; 1489330d57fbSAl Viro p->used++; 1490330d57fbSAl Viro return 1; 1491330d57fbSAl Viro } 1492330d57fbSAl Viro 1493330d57fbSAl Viro /* called under sysctl_lock */ 1494330d57fbSAl Viro static void unuse_table(struct ctl_table_header *p) 1495330d57fbSAl Viro { 1496330d57fbSAl Viro if (!--p->used) 1497330d57fbSAl Viro if (unlikely(p->unregistering)) 1498330d57fbSAl Viro complete(p->unregistering); 1499330d57fbSAl Viro } 1500330d57fbSAl Viro 1501330d57fbSAl Viro /* called under sysctl_lock, will reacquire if has to wait */ 1502330d57fbSAl Viro static void start_unregistering(struct ctl_table_header *p) 1503330d57fbSAl Viro { 1504330d57fbSAl Viro /* 1505330d57fbSAl Viro * if p->used is 0, nobody will ever touch that entry again; 1506330d57fbSAl Viro * we'll eliminate all paths to it before dropping sysctl_lock 1507330d57fbSAl Viro */ 1508330d57fbSAl Viro if (unlikely(p->used)) { 1509330d57fbSAl Viro struct completion wait; 1510330d57fbSAl Viro init_completion(&wait); 1511330d57fbSAl Viro p->unregistering = &wait; 1512330d57fbSAl Viro spin_unlock(&sysctl_lock); 1513330d57fbSAl Viro wait_for_completion(&wait); 1514330d57fbSAl Viro spin_lock(&sysctl_lock); 1515f7e6ced4SAl Viro } else { 1516f7e6ced4SAl Viro /* anything non-NULL; we'll never dereference it */ 1517f7e6ced4SAl Viro p->unregistering = ERR_PTR(-EINVAL); 1518330d57fbSAl Viro } 1519330d57fbSAl Viro /* 1520330d57fbSAl Viro * do not remove from the list until nobody holds it; walking the 1521330d57fbSAl Viro * list in do_sysctl() relies on that. 1522330d57fbSAl Viro */ 1523330d57fbSAl Viro list_del_init(&p->ctl_entry); 1524330d57fbSAl Viro } 1525330d57fbSAl Viro 1526f7e6ced4SAl Viro void sysctl_head_get(struct ctl_table_header *head) 1527f7e6ced4SAl Viro { 1528f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1529f7e6ced4SAl Viro head->count++; 1530f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1531f7e6ced4SAl Viro } 1532f7e6ced4SAl Viro 1533f7e6ced4SAl Viro void sysctl_head_put(struct ctl_table_header *head) 1534f7e6ced4SAl Viro { 1535f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1536f7e6ced4SAl Viro if (!--head->count) 1537f7e6ced4SAl Viro kfree(head); 1538f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1539f7e6ced4SAl Viro } 1540f7e6ced4SAl Viro 1541f7e6ced4SAl Viro struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) 1542f7e6ced4SAl Viro { 1543f7e6ced4SAl Viro if (!head) 1544f7e6ced4SAl Viro BUG(); 1545f7e6ced4SAl Viro spin_lock(&sysctl_lock); 1546f7e6ced4SAl Viro if (!use_table(head)) 1547f7e6ced4SAl Viro head = ERR_PTR(-ENOENT); 1548f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 1549f7e6ced4SAl Viro return head; 1550f7e6ced4SAl Viro } 1551f7e6ced4SAl Viro 1552805b5d5eSEric W. Biederman void sysctl_head_finish(struct ctl_table_header *head) 1553805b5d5eSEric W. Biederman { 1554805b5d5eSEric W. Biederman if (!head) 1555805b5d5eSEric W. Biederman return; 1556805b5d5eSEric W. Biederman spin_lock(&sysctl_lock); 1557805b5d5eSEric W. Biederman unuse_table(head); 1558805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1559805b5d5eSEric W. Biederman } 1560805b5d5eSEric W. Biederman 156173455092SAl Viro static struct ctl_table_set * 156273455092SAl Viro lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces) 156373455092SAl Viro { 156473455092SAl Viro struct ctl_table_set *set = &root->default_set; 156573455092SAl Viro if (root->lookup) 156673455092SAl Viro set = root->lookup(root, namespaces); 156773455092SAl Viro return set; 156873455092SAl Viro } 156973455092SAl Viro 1570e51b6ba0SEric W. Biederman static struct list_head * 1571e51b6ba0SEric W. Biederman lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces) 1572805b5d5eSEric W. Biederman { 157373455092SAl Viro struct ctl_table_set *set = lookup_header_set(root, namespaces); 157473455092SAl Viro return &set->list; 1575e51b6ba0SEric W. Biederman } 1576e51b6ba0SEric W. Biederman 1577e51b6ba0SEric W. Biederman struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 1578e51b6ba0SEric W. Biederman struct ctl_table_header *prev) 1579e51b6ba0SEric W. Biederman { 1580e51b6ba0SEric W. Biederman struct ctl_table_root *root; 1581e51b6ba0SEric W. Biederman struct list_head *header_list; 1582805b5d5eSEric W. Biederman struct ctl_table_header *head; 1583805b5d5eSEric W. Biederman struct list_head *tmp; 1584e51b6ba0SEric W. Biederman 1585805b5d5eSEric W. Biederman spin_lock(&sysctl_lock); 1586805b5d5eSEric W. Biederman if (prev) { 1587e51b6ba0SEric W. Biederman head = prev; 1588805b5d5eSEric W. Biederman tmp = &prev->ctl_entry; 1589805b5d5eSEric W. Biederman unuse_table(prev); 1590805b5d5eSEric W. Biederman goto next; 1591805b5d5eSEric W. Biederman } 1592805b5d5eSEric W. Biederman tmp = &root_table_header.ctl_entry; 1593805b5d5eSEric W. Biederman for (;;) { 1594805b5d5eSEric W. Biederman head = list_entry(tmp, struct ctl_table_header, ctl_entry); 1595805b5d5eSEric W. Biederman 1596805b5d5eSEric W. Biederman if (!use_table(head)) 1597805b5d5eSEric W. Biederman goto next; 1598805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1599805b5d5eSEric W. Biederman return head; 1600805b5d5eSEric W. Biederman next: 1601e51b6ba0SEric W. Biederman root = head->root; 1602805b5d5eSEric W. Biederman tmp = tmp->next; 1603e51b6ba0SEric W. Biederman header_list = lookup_header_list(root, namespaces); 1604e51b6ba0SEric W. Biederman if (tmp != header_list) 1605e51b6ba0SEric W. Biederman continue; 1606e51b6ba0SEric W. Biederman 1607e51b6ba0SEric W. Biederman do { 1608e51b6ba0SEric W. Biederman root = list_entry(root->root_list.next, 1609e51b6ba0SEric W. Biederman struct ctl_table_root, root_list); 1610e51b6ba0SEric W. Biederman if (root == &sysctl_table_root) 1611e51b6ba0SEric W. Biederman goto out; 1612e51b6ba0SEric W. Biederman header_list = lookup_header_list(root, namespaces); 1613e51b6ba0SEric W. Biederman } while (list_empty(header_list)); 1614e51b6ba0SEric W. Biederman tmp = header_list->next; 1615805b5d5eSEric W. Biederman } 1616e51b6ba0SEric W. Biederman out: 1617805b5d5eSEric W. Biederman spin_unlock(&sysctl_lock); 1618805b5d5eSEric W. Biederman return NULL; 1619805b5d5eSEric W. Biederman } 1620805b5d5eSEric W. Biederman 1621e51b6ba0SEric W. Biederman struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev) 1622e51b6ba0SEric W. Biederman { 1623e51b6ba0SEric W. Biederman return __sysctl_head_next(current->nsproxy, prev); 1624e51b6ba0SEric W. Biederman } 1625e51b6ba0SEric W. Biederman 1626e51b6ba0SEric W. Biederman void register_sysctl_root(struct ctl_table_root *root) 1627e51b6ba0SEric W. Biederman { 1628e51b6ba0SEric W. Biederman spin_lock(&sysctl_lock); 1629e51b6ba0SEric W. Biederman list_add_tail(&root->root_list, &sysctl_table_root.root_list); 1630e51b6ba0SEric W. Biederman spin_unlock(&sysctl_lock); 1631e51b6ba0SEric W. Biederman } 1632e51b6ba0SEric W. Biederman 16331da177e4SLinus Torvalds /* 16341ff007ebSEric W. Biederman * sysctl_perm does NOT grant the superuser all rights automatically, because 16351da177e4SLinus Torvalds * some sysctl variables are readonly even to root. 16361da177e4SLinus Torvalds */ 16371da177e4SLinus Torvalds 16381da177e4SLinus Torvalds static int test_perm(int mode, int op) 16391da177e4SLinus Torvalds { 164076aac0e9SDavid Howells if (!current_euid()) 16411da177e4SLinus Torvalds mode >>= 6; 16421da177e4SLinus Torvalds else if (in_egroup_p(0)) 16431da177e4SLinus Torvalds mode >>= 3; 1644e6305c43SAl Viro if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0) 16451da177e4SLinus Torvalds return 0; 16461da177e4SLinus Torvalds return -EACCES; 16471da177e4SLinus Torvalds } 16481da177e4SLinus Torvalds 1649d7321cd6SPavel Emelyanov int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) 16501da177e4SLinus Torvalds { 16511da177e4SLinus Torvalds int error; 1652d7321cd6SPavel Emelyanov int mode; 1653d7321cd6SPavel Emelyanov 1654e6305c43SAl Viro error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC)); 16551da177e4SLinus Torvalds if (error) 16561da177e4SLinus Torvalds return error; 1657d7321cd6SPavel Emelyanov 1658d7321cd6SPavel Emelyanov if (root->permissions) 1659d7321cd6SPavel Emelyanov mode = root->permissions(root, current->nsproxy, table); 1660d7321cd6SPavel Emelyanov else 1661d7321cd6SPavel Emelyanov mode = table->mode; 1662d7321cd6SPavel Emelyanov 1663d7321cd6SPavel Emelyanov return test_perm(mode, op); 16641da177e4SLinus Torvalds } 16651da177e4SLinus Torvalds 1666d912b0ccSEric W. Biederman static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1667d912b0ccSEric W. Biederman { 16682315ffa0SEric W. Biederman for (; table->procname; table++) { 1669d912b0ccSEric W. Biederman table->parent = parent; 1670d912b0ccSEric W. Biederman if (table->child) 1671d912b0ccSEric W. Biederman sysctl_set_parent(table, table->child); 1672d912b0ccSEric W. Biederman } 1673d912b0ccSEric W. Biederman } 1674d912b0ccSEric W. Biederman 1675d912b0ccSEric W. Biederman static __init int sysctl_init(void) 1676d912b0ccSEric W. Biederman { 1677d912b0ccSEric W. Biederman sysctl_set_parent(NULL, root_table); 167888f458e4SHolger Schurig #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 167988f458e4SHolger Schurig { 168088f458e4SHolger Schurig int err; 1681e51b6ba0SEric W. Biederman err = sysctl_check_table(current->nsproxy, root_table); 168288f458e4SHolger Schurig } 168388f458e4SHolger Schurig #endif 1684d912b0ccSEric W. Biederman return 0; 1685d912b0ccSEric W. Biederman } 1686d912b0ccSEric W. Biederman 1687d912b0ccSEric W. Biederman core_initcall(sysctl_init); 1688d912b0ccSEric W. Biederman 1689bfbcf034SAl Viro static struct ctl_table *is_branch_in(struct ctl_table *branch, 1690bfbcf034SAl Viro struct ctl_table *table) 1691ae7edeccSAl Viro { 1692ae7edeccSAl Viro struct ctl_table *p; 1693ae7edeccSAl Viro const char *s = branch->procname; 1694ae7edeccSAl Viro 1695ae7edeccSAl Viro /* branch should have named subdirectory as its first element */ 1696ae7edeccSAl Viro if (!s || !branch->child) 1697bfbcf034SAl Viro return NULL; 1698ae7edeccSAl Viro 1699ae7edeccSAl Viro /* ... and nothing else */ 17002315ffa0SEric W. Biederman if (branch[1].procname) 1701bfbcf034SAl Viro return NULL; 1702ae7edeccSAl Viro 1703ae7edeccSAl Viro /* table should contain subdirectory with the same name */ 17042315ffa0SEric W. Biederman for (p = table; p->procname; p++) { 1705ae7edeccSAl Viro if (!p->child) 1706ae7edeccSAl Viro continue; 1707ae7edeccSAl Viro if (p->procname && strcmp(p->procname, s) == 0) 1708bfbcf034SAl Viro return p; 1709ae7edeccSAl Viro } 1710bfbcf034SAl Viro return NULL; 1711ae7edeccSAl Viro } 1712ae7edeccSAl Viro 1713ae7edeccSAl Viro /* see if attaching q to p would be an improvement */ 1714ae7edeccSAl Viro static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) 1715ae7edeccSAl Viro { 1716ae7edeccSAl Viro struct ctl_table *to = p->ctl_table, *by = q->ctl_table; 1717bfbcf034SAl Viro struct ctl_table *next; 1718ae7edeccSAl Viro int is_better = 0; 1719ae7edeccSAl Viro int not_in_parent = !p->attached_by; 1720ae7edeccSAl Viro 1721bfbcf034SAl Viro while ((next = is_branch_in(by, to)) != NULL) { 1722ae7edeccSAl Viro if (by == q->attached_by) 1723ae7edeccSAl Viro is_better = 1; 1724ae7edeccSAl Viro if (to == p->attached_by) 1725ae7edeccSAl Viro not_in_parent = 1; 1726ae7edeccSAl Viro by = by->child; 1727bfbcf034SAl Viro to = next->child; 1728ae7edeccSAl Viro } 1729ae7edeccSAl Viro 1730ae7edeccSAl Viro if (is_better && not_in_parent) { 1731ae7edeccSAl Viro q->attached_by = by; 1732ae7edeccSAl Viro q->attached_to = to; 1733ae7edeccSAl Viro q->parent = p; 1734ae7edeccSAl Viro } 1735ae7edeccSAl Viro } 1736ae7edeccSAl Viro 17371da177e4SLinus Torvalds /** 1738e51b6ba0SEric W. Biederman * __register_sysctl_paths - register a sysctl hierarchy 1739e51b6ba0SEric W. Biederman * @root: List of sysctl headers to register on 1740e51b6ba0SEric W. Biederman * @namespaces: Data to compute which lists of sysctl entries are visible 174129e796fdSEric W. Biederman * @path: The path to the directory the sysctl table is in. 17421da177e4SLinus Torvalds * @table: the top-level table structure 17431da177e4SLinus Torvalds * 17441da177e4SLinus Torvalds * Register a sysctl table hierarchy. @table should be a filled in ctl_table 174529e796fdSEric W. Biederman * array. A completely 0 filled entry terminates the table. 17461da177e4SLinus Torvalds * 1747d8217f07SEric W. Biederman * The members of the &struct ctl_table structure are used as follows: 17481da177e4SLinus Torvalds * 17491da177e4SLinus Torvalds * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not 17501da177e4SLinus Torvalds * enter a sysctl file 17511da177e4SLinus Torvalds * 17521da177e4SLinus Torvalds * data - a pointer to data for use by proc_handler 17531da177e4SLinus Torvalds * 17541da177e4SLinus Torvalds * maxlen - the maximum size in bytes of the data 17551da177e4SLinus Torvalds * 17561da177e4SLinus Torvalds * mode - the file permissions for the /proc/sys file, and for sysctl(2) 17571da177e4SLinus Torvalds * 17581da177e4SLinus Torvalds * child - a pointer to the child sysctl table if this entry is a directory, or 17591da177e4SLinus Torvalds * %NULL. 17601da177e4SLinus Torvalds * 17611da177e4SLinus Torvalds * proc_handler - the text handler routine (described below) 17621da177e4SLinus Torvalds * 17631da177e4SLinus Torvalds * de - for internal use by the sysctl routines 17641da177e4SLinus Torvalds * 17651da177e4SLinus Torvalds * extra1, extra2 - extra pointers usable by the proc handler routines 17661da177e4SLinus Torvalds * 17671da177e4SLinus Torvalds * Leaf nodes in the sysctl tree will be represented by a single file 17681da177e4SLinus Torvalds * under /proc; non-leaf nodes will be represented by directories. 17691da177e4SLinus Torvalds * 17701da177e4SLinus Torvalds * sysctl(2) can automatically manage read and write requests through 17711da177e4SLinus Torvalds * the sysctl table. The data and maxlen fields of the ctl_table 17721da177e4SLinus Torvalds * struct enable minimal validation of the values being written to be 17731da177e4SLinus Torvalds * performed, and the mode field allows minimal authentication. 17741da177e4SLinus Torvalds * 17751da177e4SLinus Torvalds * There must be a proc_handler routine for any terminal nodes 17761da177e4SLinus Torvalds * mirrored under /proc/sys (non-terminals are handled by a built-in 17771da177e4SLinus Torvalds * directory handler). Several default handlers are available to 17781da177e4SLinus Torvalds * cover common cases - 17791da177e4SLinus Torvalds * 17801da177e4SLinus Torvalds * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(), 17811da177e4SLinus Torvalds * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(), 17821da177e4SLinus Torvalds * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax() 17831da177e4SLinus Torvalds * 17841da177e4SLinus Torvalds * It is the handler's job to read the input buffer from user memory 17851da177e4SLinus Torvalds * and process it. The handler should return 0 on success. 17861da177e4SLinus Torvalds * 17871da177e4SLinus Torvalds * This routine returns %NULL on a failure to register, and a pointer 17881da177e4SLinus Torvalds * to the table header on success. 17891da177e4SLinus Torvalds */ 1790e51b6ba0SEric W. Biederman struct ctl_table_header *__register_sysctl_paths( 1791e51b6ba0SEric W. Biederman struct ctl_table_root *root, 1792e51b6ba0SEric W. Biederman struct nsproxy *namespaces, 1793e51b6ba0SEric W. Biederman const struct ctl_path *path, struct ctl_table *table) 17941da177e4SLinus Torvalds { 179529e796fdSEric W. Biederman struct ctl_table_header *header; 179629e796fdSEric W. Biederman struct ctl_table *new, **prevp; 179729e796fdSEric W. Biederman unsigned int n, npath; 1798ae7edeccSAl Viro struct ctl_table_set *set; 179929e796fdSEric W. Biederman 180029e796fdSEric W. Biederman /* Count the path components */ 18012315ffa0SEric W. Biederman for (npath = 0; path[npath].procname; ++npath) 180229e796fdSEric W. Biederman ; 180329e796fdSEric W. Biederman 180429e796fdSEric W. Biederman /* 180529e796fdSEric W. Biederman * For each path component, allocate a 2-element ctl_table array. 180629e796fdSEric W. Biederman * The first array element will be filled with the sysctl entry 18072315ffa0SEric W. Biederman * for this, the second will be the sentinel (procname == 0). 180829e796fdSEric W. Biederman * 180929e796fdSEric W. Biederman * We allocate everything in one go so that we don't have to 181029e796fdSEric W. Biederman * worry about freeing additional memory in unregister_sysctl_table. 181129e796fdSEric W. Biederman */ 181229e796fdSEric W. Biederman header = kzalloc(sizeof(struct ctl_table_header) + 181329e796fdSEric W. Biederman (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL); 181429e796fdSEric W. Biederman if (!header) 18151da177e4SLinus Torvalds return NULL; 181629e796fdSEric W. Biederman 181729e796fdSEric W. Biederman new = (struct ctl_table *) (header + 1); 181829e796fdSEric W. Biederman 181929e796fdSEric W. Biederman /* Now connect the dots */ 182029e796fdSEric W. Biederman prevp = &header->ctl_table; 182129e796fdSEric W. Biederman for (n = 0; n < npath; ++n, ++path) { 182229e796fdSEric W. Biederman /* Copy the procname */ 182329e796fdSEric W. Biederman new->procname = path->procname; 182429e796fdSEric W. Biederman new->mode = 0555; 182529e796fdSEric W. Biederman 182629e796fdSEric W. Biederman *prevp = new; 182729e796fdSEric W. Biederman prevp = &new->child; 182829e796fdSEric W. Biederman 182929e796fdSEric W. Biederman new += 2; 183029e796fdSEric W. Biederman } 183129e796fdSEric W. Biederman *prevp = table; 183223eb06deSEric W. Biederman header->ctl_table_arg = table; 183329e796fdSEric W. Biederman 183429e796fdSEric W. Biederman INIT_LIST_HEAD(&header->ctl_entry); 183529e796fdSEric W. Biederman header->used = 0; 183629e796fdSEric W. Biederman header->unregistering = NULL; 1837e51b6ba0SEric W. Biederman header->root = root; 183829e796fdSEric W. Biederman sysctl_set_parent(NULL, header->ctl_table); 1839f7e6ced4SAl Viro header->count = 1; 184088f458e4SHolger Schurig #ifdef CONFIG_SYSCTL_SYSCALL_CHECK 1841e51b6ba0SEric W. Biederman if (sysctl_check_table(namespaces, header->ctl_table)) { 184229e796fdSEric W. Biederman kfree(header); 1843fc6cd25bSEric W. Biederman return NULL; 1844fc6cd25bSEric W. Biederman } 184588f458e4SHolger Schurig #endif 1846330d57fbSAl Viro spin_lock(&sysctl_lock); 184773455092SAl Viro header->set = lookup_header_set(root, namespaces); 1848ae7edeccSAl Viro header->attached_by = header->ctl_table; 1849ae7edeccSAl Viro header->attached_to = root_table; 1850ae7edeccSAl Viro header->parent = &root_table_header; 1851ae7edeccSAl Viro for (set = header->set; set; set = set->parent) { 1852ae7edeccSAl Viro struct ctl_table_header *p; 1853ae7edeccSAl Viro list_for_each_entry(p, &set->list, ctl_entry) { 1854ae7edeccSAl Viro if (p->unregistering) 1855ae7edeccSAl Viro continue; 1856ae7edeccSAl Viro try_attach(p, header); 1857ae7edeccSAl Viro } 1858ae7edeccSAl Viro } 1859ae7edeccSAl Viro header->parent->count++; 186073455092SAl Viro list_add_tail(&header->ctl_entry, &header->set->list); 1861330d57fbSAl Viro spin_unlock(&sysctl_lock); 186229e796fdSEric W. Biederman 186329e796fdSEric W. Biederman return header; 186429e796fdSEric W. Biederman } 186529e796fdSEric W. Biederman 186629e796fdSEric W. Biederman /** 1867e51b6ba0SEric W. Biederman * register_sysctl_table_path - register a sysctl table hierarchy 1868e51b6ba0SEric W. Biederman * @path: The path to the directory the sysctl table is in. 1869e51b6ba0SEric W. Biederman * @table: the top-level table structure 1870e51b6ba0SEric W. Biederman * 1871e51b6ba0SEric W. Biederman * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1872e51b6ba0SEric W. Biederman * array. A completely 0 filled entry terminates the table. 1873e51b6ba0SEric W. Biederman * 1874e51b6ba0SEric W. Biederman * See __register_sysctl_paths for more details. 1875e51b6ba0SEric W. Biederman */ 1876e51b6ba0SEric W. Biederman struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1877e51b6ba0SEric W. Biederman struct ctl_table *table) 1878e51b6ba0SEric W. Biederman { 1879e51b6ba0SEric W. Biederman return __register_sysctl_paths(&sysctl_table_root, current->nsproxy, 1880e51b6ba0SEric W. Biederman path, table); 1881e51b6ba0SEric W. Biederman } 1882e51b6ba0SEric W. Biederman 1883e51b6ba0SEric W. Biederman /** 188429e796fdSEric W. Biederman * register_sysctl_table - register a sysctl table hierarchy 188529e796fdSEric W. Biederman * @table: the top-level table structure 188629e796fdSEric W. Biederman * 188729e796fdSEric W. Biederman * Register a sysctl table hierarchy. @table should be a filled in ctl_table 188829e796fdSEric W. Biederman * array. A completely 0 filled entry terminates the table. 188929e796fdSEric W. Biederman * 189029e796fdSEric W. Biederman * See register_sysctl_paths for more details. 189129e796fdSEric W. Biederman */ 189229e796fdSEric W. Biederman struct ctl_table_header *register_sysctl_table(struct ctl_table *table) 189329e796fdSEric W. Biederman { 189429e796fdSEric W. Biederman static const struct ctl_path null_path[] = { {} }; 189529e796fdSEric W. Biederman 189629e796fdSEric W. Biederman return register_sysctl_paths(null_path, table); 18971da177e4SLinus Torvalds } 18981da177e4SLinus Torvalds 18991da177e4SLinus Torvalds /** 19001da177e4SLinus Torvalds * unregister_sysctl_table - unregister a sysctl table hierarchy 19011da177e4SLinus Torvalds * @header: the header returned from register_sysctl_table 19021da177e4SLinus Torvalds * 19031da177e4SLinus Torvalds * Unregisters the sysctl table and all children. proc entries may not 19041da177e4SLinus Torvalds * actually be removed until they are no longer used by anyone. 19051da177e4SLinus Torvalds */ 19061da177e4SLinus Torvalds void unregister_sysctl_table(struct ctl_table_header * header) 19071da177e4SLinus Torvalds { 1908330d57fbSAl Viro might_sleep(); 1909f1dad166SPavel Emelyanov 1910f1dad166SPavel Emelyanov if (header == NULL) 1911f1dad166SPavel Emelyanov return; 1912f1dad166SPavel Emelyanov 1913330d57fbSAl Viro spin_lock(&sysctl_lock); 1914330d57fbSAl Viro start_unregistering(header); 1915ae7edeccSAl Viro if (!--header->parent->count) { 1916ae7edeccSAl Viro WARN_ON(1); 1917ae7edeccSAl Viro kfree(header->parent); 1918ae7edeccSAl Viro } 1919f7e6ced4SAl Viro if (!--header->count) 19201da177e4SLinus Torvalds kfree(header); 1921f7e6ced4SAl Viro spin_unlock(&sysctl_lock); 19221da177e4SLinus Torvalds } 19231da177e4SLinus Torvalds 19249043476fSAl Viro int sysctl_is_seen(struct ctl_table_header *p) 19259043476fSAl Viro { 19269043476fSAl Viro struct ctl_table_set *set = p->set; 19279043476fSAl Viro int res; 19289043476fSAl Viro spin_lock(&sysctl_lock); 19299043476fSAl Viro if (p->unregistering) 19309043476fSAl Viro res = 0; 19319043476fSAl Viro else if (!set->is_seen) 19329043476fSAl Viro res = 1; 19339043476fSAl Viro else 19349043476fSAl Viro res = set->is_seen(set); 19359043476fSAl Viro spin_unlock(&sysctl_lock); 19369043476fSAl Viro return res; 19379043476fSAl Viro } 19389043476fSAl Viro 193973455092SAl Viro void setup_sysctl_set(struct ctl_table_set *p, 194073455092SAl Viro struct ctl_table_set *parent, 194173455092SAl Viro int (*is_seen)(struct ctl_table_set *)) 194273455092SAl Viro { 194373455092SAl Viro INIT_LIST_HEAD(&p->list); 194473455092SAl Viro p->parent = parent ? parent : &sysctl_table_root.default_set; 194573455092SAl Viro p->is_seen = is_seen; 194673455092SAl Viro } 194773455092SAl Viro 1948b89a8171SEric W. Biederman #else /* !CONFIG_SYSCTL */ 1949d8217f07SEric W. Biederman struct ctl_table_header *register_sysctl_table(struct ctl_table * table) 1950b89a8171SEric W. Biederman { 1951b89a8171SEric W. Biederman return NULL; 1952b89a8171SEric W. Biederman } 1953b89a8171SEric W. Biederman 195429e796fdSEric W. Biederman struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 195529e796fdSEric W. Biederman struct ctl_table *table) 195629e796fdSEric W. Biederman { 195729e796fdSEric W. Biederman return NULL; 195829e796fdSEric W. Biederman } 195929e796fdSEric W. Biederman 1960b89a8171SEric W. Biederman void unregister_sysctl_table(struct ctl_table_header * table) 1961b89a8171SEric W. Biederman { 1962b89a8171SEric W. Biederman } 1963b89a8171SEric W. Biederman 196473455092SAl Viro void setup_sysctl_set(struct ctl_table_set *p, 196573455092SAl Viro struct ctl_table_set *parent, 196673455092SAl Viro int (*is_seen)(struct ctl_table_set *)) 196773455092SAl Viro { 196873455092SAl Viro } 196973455092SAl Viro 1970f7e6ced4SAl Viro void sysctl_head_put(struct ctl_table_header *head) 1971f7e6ced4SAl Viro { 1972f7e6ced4SAl Viro } 1973f7e6ced4SAl Viro 1974b89a8171SEric W. Biederman #endif /* CONFIG_SYSCTL */ 1975b89a8171SEric W. Biederman 19761da177e4SLinus Torvalds /* 19771da177e4SLinus Torvalds * /proc/sys support 19781da177e4SLinus Torvalds */ 19791da177e4SLinus Torvalds 1980b89a8171SEric W. Biederman #ifdef CONFIG_PROC_SYSCTL 19811da177e4SLinus Torvalds 1982b1ba4dddSAdrian Bunk static int _proc_do_string(void* data, int maxlen, int write, 19838d65af78SAlexey Dobriyan void __user *buffer, 1984b1ba4dddSAdrian Bunk size_t *lenp, loff_t *ppos) 1985f5dd3d6fSSam Vilain { 1986f5dd3d6fSSam Vilain size_t len; 1987f5dd3d6fSSam Vilain char __user *p; 1988f5dd3d6fSSam Vilain char c; 1989f5dd3d6fSSam Vilain 19908d060877SOleg Nesterov if (!data || !maxlen || !*lenp) { 1991f5dd3d6fSSam Vilain *lenp = 0; 1992f5dd3d6fSSam Vilain return 0; 1993f5dd3d6fSSam Vilain } 1994f5dd3d6fSSam Vilain 1995f5dd3d6fSSam Vilain if (write) { 1996f5dd3d6fSSam Vilain len = 0; 1997f5dd3d6fSSam Vilain p = buffer; 1998f5dd3d6fSSam Vilain while (len < *lenp) { 1999f5dd3d6fSSam Vilain if (get_user(c, p++)) 2000f5dd3d6fSSam Vilain return -EFAULT; 2001f5dd3d6fSSam Vilain if (c == 0 || c == '\n') 2002f5dd3d6fSSam Vilain break; 2003f5dd3d6fSSam Vilain len++; 2004f5dd3d6fSSam Vilain } 2005f5dd3d6fSSam Vilain if (len >= maxlen) 2006f5dd3d6fSSam Vilain len = maxlen-1; 2007f5dd3d6fSSam Vilain if(copy_from_user(data, buffer, len)) 2008f5dd3d6fSSam Vilain return -EFAULT; 2009f5dd3d6fSSam Vilain ((char *) data)[len] = 0; 2010f5dd3d6fSSam Vilain *ppos += *lenp; 2011f5dd3d6fSSam Vilain } else { 2012f5dd3d6fSSam Vilain len = strlen(data); 2013f5dd3d6fSSam Vilain if (len > maxlen) 2014f5dd3d6fSSam Vilain len = maxlen; 20158d060877SOleg Nesterov 20168d060877SOleg Nesterov if (*ppos > len) { 20178d060877SOleg Nesterov *lenp = 0; 20188d060877SOleg Nesterov return 0; 20198d060877SOleg Nesterov } 20208d060877SOleg Nesterov 20218d060877SOleg Nesterov data += *ppos; 20228d060877SOleg Nesterov len -= *ppos; 20238d060877SOleg Nesterov 2024f5dd3d6fSSam Vilain if (len > *lenp) 2025f5dd3d6fSSam Vilain len = *lenp; 2026f5dd3d6fSSam Vilain if (len) 2027f5dd3d6fSSam Vilain if(copy_to_user(buffer, data, len)) 2028f5dd3d6fSSam Vilain return -EFAULT; 2029f5dd3d6fSSam Vilain if (len < *lenp) { 2030f5dd3d6fSSam Vilain if(put_user('\n', ((char __user *) buffer) + len)) 2031f5dd3d6fSSam Vilain return -EFAULT; 2032f5dd3d6fSSam Vilain len++; 2033f5dd3d6fSSam Vilain } 2034f5dd3d6fSSam Vilain *lenp = len; 2035f5dd3d6fSSam Vilain *ppos += len; 2036f5dd3d6fSSam Vilain } 2037f5dd3d6fSSam Vilain return 0; 2038f5dd3d6fSSam Vilain } 2039f5dd3d6fSSam Vilain 20401da177e4SLinus Torvalds /** 20411da177e4SLinus Torvalds * proc_dostring - read a string sysctl 20421da177e4SLinus Torvalds * @table: the sysctl table 20431da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 20441da177e4SLinus Torvalds * @buffer: the user buffer 20451da177e4SLinus Torvalds * @lenp: the size of the user buffer 20461da177e4SLinus Torvalds * @ppos: file position 20471da177e4SLinus Torvalds * 20481da177e4SLinus Torvalds * Reads/writes a string from/to the user buffer. If the kernel 20491da177e4SLinus Torvalds * buffer provided is not large enough to hold the string, the 20501da177e4SLinus Torvalds * string is truncated. The copied string is %NULL-terminated. 20511da177e4SLinus Torvalds * If the string is being read by the user process, it is copied 20521da177e4SLinus Torvalds * and a newline '\n' is added. It is truncated if the buffer is 20531da177e4SLinus Torvalds * not large enough. 20541da177e4SLinus Torvalds * 20551da177e4SLinus Torvalds * Returns 0 on success. 20561da177e4SLinus Torvalds */ 20578d65af78SAlexey Dobriyan int proc_dostring(struct ctl_table *table, int write, 20581da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 20591da177e4SLinus Torvalds { 20608d65af78SAlexey Dobriyan return _proc_do_string(table->data, table->maxlen, write, 2061f5dd3d6fSSam Vilain buffer, lenp, ppos); 20621da177e4SLinus Torvalds } 20631da177e4SLinus Torvalds 20641da177e4SLinus Torvalds 20651da177e4SLinus Torvalds static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, 20661da177e4SLinus Torvalds int *valp, 20671da177e4SLinus Torvalds int write, void *data) 20681da177e4SLinus Torvalds { 20691da177e4SLinus Torvalds if (write) { 20701da177e4SLinus Torvalds *valp = *negp ? -*lvalp : *lvalp; 20711da177e4SLinus Torvalds } else { 20721da177e4SLinus Torvalds int val = *valp; 20731da177e4SLinus Torvalds if (val < 0) { 20741da177e4SLinus Torvalds *negp = -1; 20751da177e4SLinus Torvalds *lvalp = (unsigned long)-val; 20761da177e4SLinus Torvalds } else { 20771da177e4SLinus Torvalds *negp = 0; 20781da177e4SLinus Torvalds *lvalp = (unsigned long)val; 20791da177e4SLinus Torvalds } 20801da177e4SLinus Torvalds } 20811da177e4SLinus Torvalds return 0; 20821da177e4SLinus Torvalds } 20831da177e4SLinus Torvalds 2084d8217f07SEric W. Biederman static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, 20858d65af78SAlexey Dobriyan int write, void __user *buffer, 2086fcfbd547SKirill Korotaev size_t *lenp, loff_t *ppos, 20871da177e4SLinus Torvalds int (*conv)(int *negp, unsigned long *lvalp, int *valp, 20881da177e4SLinus Torvalds int write, void *data), 20891da177e4SLinus Torvalds void *data) 20901da177e4SLinus Torvalds { 20911da177e4SLinus Torvalds #define TMPBUFLEN 21 20927338f299SSukanto Ghosh int *i, vleft, first = 1, neg; 20931da177e4SLinus Torvalds unsigned long lval; 20941da177e4SLinus Torvalds size_t left, len; 20951da177e4SLinus Torvalds 20961da177e4SLinus Torvalds char buf[TMPBUFLEN], *p; 20971da177e4SLinus Torvalds char __user *s = buffer; 20981da177e4SLinus Torvalds 2099fcfbd547SKirill Korotaev if (!tbl_data || !table->maxlen || !*lenp || 21001da177e4SLinus Torvalds (*ppos && !write)) { 21011da177e4SLinus Torvalds *lenp = 0; 21021da177e4SLinus Torvalds return 0; 21031da177e4SLinus Torvalds } 21041da177e4SLinus Torvalds 2105fcfbd547SKirill Korotaev i = (int *) tbl_data; 21061da177e4SLinus Torvalds vleft = table->maxlen / sizeof(*i); 21071da177e4SLinus Torvalds left = *lenp; 21081da177e4SLinus Torvalds 21091da177e4SLinus Torvalds if (!conv) 21101da177e4SLinus Torvalds conv = do_proc_dointvec_conv; 21111da177e4SLinus Torvalds 21121da177e4SLinus Torvalds for (; left && vleft--; i++, first=0) { 21131da177e4SLinus Torvalds if (write) { 21141da177e4SLinus Torvalds while (left) { 21151da177e4SLinus Torvalds char c; 21161da177e4SLinus Torvalds if (get_user(c, s)) 21171da177e4SLinus Torvalds return -EFAULT; 21181da177e4SLinus Torvalds if (!isspace(c)) 21191da177e4SLinus Torvalds break; 21201da177e4SLinus Torvalds left--; 21211da177e4SLinus Torvalds s++; 21221da177e4SLinus Torvalds } 21231da177e4SLinus Torvalds if (!left) 21241da177e4SLinus Torvalds break; 21251da177e4SLinus Torvalds neg = 0; 21261da177e4SLinus Torvalds len = left; 21271da177e4SLinus Torvalds if (len > sizeof(buf) - 1) 21281da177e4SLinus Torvalds len = sizeof(buf) - 1; 21291da177e4SLinus Torvalds if (copy_from_user(buf, s, len)) 21301da177e4SLinus Torvalds return -EFAULT; 21311da177e4SLinus Torvalds buf[len] = 0; 21321da177e4SLinus Torvalds p = buf; 21331da177e4SLinus Torvalds if (*p == '-' && left > 1) { 21341da177e4SLinus Torvalds neg = 1; 2135bd9b0bacSBP, Praveen p++; 21361da177e4SLinus Torvalds } 21371da177e4SLinus Torvalds if (*p < '0' || *p > '9') 21381da177e4SLinus Torvalds break; 21391da177e4SLinus Torvalds 21401da177e4SLinus Torvalds lval = simple_strtoul(p, &p, 0); 21411da177e4SLinus Torvalds 21421da177e4SLinus Torvalds len = p-buf; 21431da177e4SLinus Torvalds if ((len < left) && *p && !isspace(*p)) 21441da177e4SLinus Torvalds break; 21451da177e4SLinus Torvalds s += len; 21461da177e4SLinus Torvalds left -= len; 21471da177e4SLinus Torvalds 21481da177e4SLinus Torvalds if (conv(&neg, &lval, i, 1, data)) 21491da177e4SLinus Torvalds break; 21501da177e4SLinus Torvalds } else { 21511da177e4SLinus Torvalds p = buf; 21521da177e4SLinus Torvalds if (!first) 21531da177e4SLinus Torvalds *p++ = '\t'; 21541da177e4SLinus Torvalds 21551da177e4SLinus Torvalds if (conv(&neg, &lval, i, 0, data)) 21561da177e4SLinus Torvalds break; 21571da177e4SLinus Torvalds 21581da177e4SLinus Torvalds sprintf(p, "%s%lu", neg ? "-" : "", lval); 21591da177e4SLinus Torvalds len = strlen(buf); 21601da177e4SLinus Torvalds if (len > left) 21611da177e4SLinus Torvalds len = left; 21621da177e4SLinus Torvalds if(copy_to_user(s, buf, len)) 21631da177e4SLinus Torvalds return -EFAULT; 21641da177e4SLinus Torvalds left -= len; 21651da177e4SLinus Torvalds s += len; 21661da177e4SLinus Torvalds } 21671da177e4SLinus Torvalds } 21681da177e4SLinus Torvalds 21691da177e4SLinus Torvalds if (!write && !first && left) { 21701da177e4SLinus Torvalds if(put_user('\n', s)) 21711da177e4SLinus Torvalds return -EFAULT; 21721da177e4SLinus Torvalds left--, s++; 21731da177e4SLinus Torvalds } 21741da177e4SLinus Torvalds if (write) { 21751da177e4SLinus Torvalds while (left) { 21761da177e4SLinus Torvalds char c; 21771da177e4SLinus Torvalds if (get_user(c, s++)) 21781da177e4SLinus Torvalds return -EFAULT; 21791da177e4SLinus Torvalds if (!isspace(c)) 21801da177e4SLinus Torvalds break; 21811da177e4SLinus Torvalds left--; 21821da177e4SLinus Torvalds } 21831da177e4SLinus Torvalds } 21841da177e4SLinus Torvalds if (write && first) 21851da177e4SLinus Torvalds return -EINVAL; 21861da177e4SLinus Torvalds *lenp -= left; 21871da177e4SLinus Torvalds *ppos += *lenp; 21881da177e4SLinus Torvalds return 0; 21891da177e4SLinus Torvalds #undef TMPBUFLEN 21901da177e4SLinus Torvalds } 21911da177e4SLinus Torvalds 21928d65af78SAlexey Dobriyan static int do_proc_dointvec(struct ctl_table *table, int write, 2193fcfbd547SKirill Korotaev void __user *buffer, size_t *lenp, loff_t *ppos, 2194fcfbd547SKirill Korotaev int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2195fcfbd547SKirill Korotaev int write, void *data), 2196fcfbd547SKirill Korotaev void *data) 2197fcfbd547SKirill Korotaev { 21988d65af78SAlexey Dobriyan return __do_proc_dointvec(table->data, table, write, 2199fcfbd547SKirill Korotaev buffer, lenp, ppos, conv, data); 2200fcfbd547SKirill Korotaev } 2201fcfbd547SKirill Korotaev 22021da177e4SLinus Torvalds /** 22031da177e4SLinus Torvalds * proc_dointvec - read a vector of integers 22041da177e4SLinus Torvalds * @table: the sysctl table 22051da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 22061da177e4SLinus Torvalds * @buffer: the user buffer 22071da177e4SLinus Torvalds * @lenp: the size of the user buffer 22081da177e4SLinus Torvalds * @ppos: file position 22091da177e4SLinus Torvalds * 22101da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 22111da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 22121da177e4SLinus Torvalds * 22131da177e4SLinus Torvalds * Returns 0 on success. 22141da177e4SLinus Torvalds */ 22158d65af78SAlexey Dobriyan int proc_dointvec(struct ctl_table *table, int write, 22161da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 22171da177e4SLinus Torvalds { 22188d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 22191da177e4SLinus Torvalds NULL,NULL); 22201da177e4SLinus Torvalds } 22211da177e4SLinus Torvalds 222234f5a398STheodore Ts'o /* 222334f5a398STheodore Ts'o * Taint values can only be increased 222425ddbb18SAndi Kleen * This means we can safely use a temporary. 222534f5a398STheodore Ts'o */ 22268d65af78SAlexey Dobriyan static int proc_taint(struct ctl_table *table, int write, 222734f5a398STheodore Ts'o void __user *buffer, size_t *lenp, loff_t *ppos) 222834f5a398STheodore Ts'o { 222925ddbb18SAndi Kleen struct ctl_table t; 223025ddbb18SAndi Kleen unsigned long tmptaint = get_taint(); 223125ddbb18SAndi Kleen int err; 223234f5a398STheodore Ts'o 223391fcd412SBastian Blank if (write && !capable(CAP_SYS_ADMIN)) 223434f5a398STheodore Ts'o return -EPERM; 223534f5a398STheodore Ts'o 223625ddbb18SAndi Kleen t = *table; 223725ddbb18SAndi Kleen t.data = &tmptaint; 22388d65af78SAlexey Dobriyan err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); 223925ddbb18SAndi Kleen if (err < 0) 224025ddbb18SAndi Kleen return err; 224125ddbb18SAndi Kleen 224225ddbb18SAndi Kleen if (write) { 224325ddbb18SAndi Kleen /* 224425ddbb18SAndi Kleen * Poor man's atomic or. Not worth adding a primitive 224525ddbb18SAndi Kleen * to everyone's atomic.h for this 224625ddbb18SAndi Kleen */ 224725ddbb18SAndi Kleen int i; 224825ddbb18SAndi Kleen for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { 224925ddbb18SAndi Kleen if ((tmptaint >> i) & 1) 225025ddbb18SAndi Kleen add_taint(i); 225125ddbb18SAndi Kleen } 225225ddbb18SAndi Kleen } 225325ddbb18SAndi Kleen 225425ddbb18SAndi Kleen return err; 225534f5a398STheodore Ts'o } 225634f5a398STheodore Ts'o 22571da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param { 22581da177e4SLinus Torvalds int *min; 22591da177e4SLinus Torvalds int *max; 22601da177e4SLinus Torvalds }; 22611da177e4SLinus Torvalds 22621da177e4SLinus Torvalds static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, 22631da177e4SLinus Torvalds int *valp, 22641da177e4SLinus Torvalds int write, void *data) 22651da177e4SLinus Torvalds { 22661da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param *param = data; 22671da177e4SLinus Torvalds if (write) { 22681da177e4SLinus Torvalds int val = *negp ? -*lvalp : *lvalp; 22691da177e4SLinus Torvalds if ((param->min && *param->min > val) || 22701da177e4SLinus Torvalds (param->max && *param->max < val)) 22711da177e4SLinus Torvalds return -EINVAL; 22721da177e4SLinus Torvalds *valp = val; 22731da177e4SLinus Torvalds } else { 22741da177e4SLinus Torvalds int val = *valp; 22751da177e4SLinus Torvalds if (val < 0) { 22761da177e4SLinus Torvalds *negp = -1; 22771da177e4SLinus Torvalds *lvalp = (unsigned long)-val; 22781da177e4SLinus Torvalds } else { 22791da177e4SLinus Torvalds *negp = 0; 22801da177e4SLinus Torvalds *lvalp = (unsigned long)val; 22811da177e4SLinus Torvalds } 22821da177e4SLinus Torvalds } 22831da177e4SLinus Torvalds return 0; 22841da177e4SLinus Torvalds } 22851da177e4SLinus Torvalds 22861da177e4SLinus Torvalds /** 22871da177e4SLinus Torvalds * proc_dointvec_minmax - read a vector of integers with min/max values 22881da177e4SLinus Torvalds * @table: the sysctl table 22891da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 22901da177e4SLinus Torvalds * @buffer: the user buffer 22911da177e4SLinus Torvalds * @lenp: the size of the user buffer 22921da177e4SLinus Torvalds * @ppos: file position 22931da177e4SLinus Torvalds * 22941da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 22951da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 22961da177e4SLinus Torvalds * 22971da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 22981da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 22991da177e4SLinus Torvalds * 23001da177e4SLinus Torvalds * Returns 0 on success. 23011da177e4SLinus Torvalds */ 23028d65af78SAlexey Dobriyan int proc_dointvec_minmax(struct ctl_table *table, int write, 23031da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 23041da177e4SLinus Torvalds { 23051da177e4SLinus Torvalds struct do_proc_dointvec_minmax_conv_param param = { 23061da177e4SLinus Torvalds .min = (int *) table->extra1, 23071da177e4SLinus Torvalds .max = (int *) table->extra2, 23081da177e4SLinus Torvalds }; 23098d65af78SAlexey Dobriyan return do_proc_dointvec(table, write, buffer, lenp, ppos, 23101da177e4SLinus Torvalds do_proc_dointvec_minmax_conv, ¶m); 23111da177e4SLinus Torvalds } 23121da177e4SLinus Torvalds 2313d8217f07SEric W. Biederman static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, 23141da177e4SLinus Torvalds void __user *buffer, 23151da177e4SLinus Torvalds size_t *lenp, loff_t *ppos, 23161da177e4SLinus Torvalds unsigned long convmul, 23171da177e4SLinus Torvalds unsigned long convdiv) 23181da177e4SLinus Torvalds { 23191da177e4SLinus Torvalds #define TMPBUFLEN 21 23201da177e4SLinus Torvalds unsigned long *i, *min, *max, val; 23211da177e4SLinus Torvalds int vleft, first=1, neg; 23221da177e4SLinus Torvalds size_t len, left; 23231da177e4SLinus Torvalds char buf[TMPBUFLEN], *p; 23241da177e4SLinus Torvalds char __user *s = buffer; 23251da177e4SLinus Torvalds 2326fcfbd547SKirill Korotaev if (!data || !table->maxlen || !*lenp || 23271da177e4SLinus Torvalds (*ppos && !write)) { 23281da177e4SLinus Torvalds *lenp = 0; 23291da177e4SLinus Torvalds return 0; 23301da177e4SLinus Torvalds } 23311da177e4SLinus Torvalds 2332fcfbd547SKirill Korotaev i = (unsigned long *) data; 23331da177e4SLinus Torvalds min = (unsigned long *) table->extra1; 23341da177e4SLinus Torvalds max = (unsigned long *) table->extra2; 23351da177e4SLinus Torvalds vleft = table->maxlen / sizeof(unsigned long); 23361da177e4SLinus Torvalds left = *lenp; 23371da177e4SLinus Torvalds 23381da177e4SLinus Torvalds for (; left && vleft--; i++, min++, max++, first=0) { 23391da177e4SLinus Torvalds if (write) { 23401da177e4SLinus Torvalds while (left) { 23411da177e4SLinus Torvalds char c; 23421da177e4SLinus Torvalds if (get_user(c, s)) 23431da177e4SLinus Torvalds return -EFAULT; 23441da177e4SLinus Torvalds if (!isspace(c)) 23451da177e4SLinus Torvalds break; 23461da177e4SLinus Torvalds left--; 23471da177e4SLinus Torvalds s++; 23481da177e4SLinus Torvalds } 23491da177e4SLinus Torvalds if (!left) 23501da177e4SLinus Torvalds break; 23511da177e4SLinus Torvalds neg = 0; 23521da177e4SLinus Torvalds len = left; 23531da177e4SLinus Torvalds if (len > TMPBUFLEN-1) 23541da177e4SLinus Torvalds len = TMPBUFLEN-1; 23551da177e4SLinus Torvalds if (copy_from_user(buf, s, len)) 23561da177e4SLinus Torvalds return -EFAULT; 23571da177e4SLinus Torvalds buf[len] = 0; 23581da177e4SLinus Torvalds p = buf; 23591da177e4SLinus Torvalds if (*p == '-' && left > 1) { 23601da177e4SLinus Torvalds neg = 1; 2361bd9b0bacSBP, Praveen p++; 23621da177e4SLinus Torvalds } 23631da177e4SLinus Torvalds if (*p < '0' || *p > '9') 23641da177e4SLinus Torvalds break; 23651da177e4SLinus Torvalds val = simple_strtoul(p, &p, 0) * convmul / convdiv ; 23661da177e4SLinus Torvalds len = p-buf; 23671da177e4SLinus Torvalds if ((len < left) && *p && !isspace(*p)) 23681da177e4SLinus Torvalds break; 23691da177e4SLinus Torvalds if (neg) 23701da177e4SLinus Torvalds val = -val; 23711da177e4SLinus Torvalds s += len; 23721da177e4SLinus Torvalds left -= len; 23731da177e4SLinus Torvalds 23741da177e4SLinus Torvalds if(neg) 23751da177e4SLinus Torvalds continue; 23761da177e4SLinus Torvalds if ((min && val < *min) || (max && val > *max)) 23771da177e4SLinus Torvalds continue; 23781da177e4SLinus Torvalds *i = val; 23791da177e4SLinus Torvalds } else { 23801da177e4SLinus Torvalds p = buf; 23811da177e4SLinus Torvalds if (!first) 23821da177e4SLinus Torvalds *p++ = '\t'; 23831da177e4SLinus Torvalds sprintf(p, "%lu", convdiv * (*i) / convmul); 23841da177e4SLinus Torvalds len = strlen(buf); 23851da177e4SLinus Torvalds if (len > left) 23861da177e4SLinus Torvalds len = left; 23871da177e4SLinus Torvalds if(copy_to_user(s, buf, len)) 23881da177e4SLinus Torvalds return -EFAULT; 23891da177e4SLinus Torvalds left -= len; 23901da177e4SLinus Torvalds s += len; 23911da177e4SLinus Torvalds } 23921da177e4SLinus Torvalds } 23931da177e4SLinus Torvalds 23941da177e4SLinus Torvalds if (!write && !first && left) { 23951da177e4SLinus Torvalds if(put_user('\n', s)) 23961da177e4SLinus Torvalds return -EFAULT; 23971da177e4SLinus Torvalds left--, s++; 23981da177e4SLinus Torvalds } 23991da177e4SLinus Torvalds if (write) { 24001da177e4SLinus Torvalds while (left) { 24011da177e4SLinus Torvalds char c; 24021da177e4SLinus Torvalds if (get_user(c, s++)) 24031da177e4SLinus Torvalds return -EFAULT; 24041da177e4SLinus Torvalds if (!isspace(c)) 24051da177e4SLinus Torvalds break; 24061da177e4SLinus Torvalds left--; 24071da177e4SLinus Torvalds } 24081da177e4SLinus Torvalds } 24091da177e4SLinus Torvalds if (write && first) 24101da177e4SLinus Torvalds return -EINVAL; 24111da177e4SLinus Torvalds *lenp -= left; 24121da177e4SLinus Torvalds *ppos += *lenp; 24131da177e4SLinus Torvalds return 0; 24141da177e4SLinus Torvalds #undef TMPBUFLEN 24151da177e4SLinus Torvalds } 24161da177e4SLinus Torvalds 2417d8217f07SEric W. Biederman static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, 2418fcfbd547SKirill Korotaev void __user *buffer, 2419fcfbd547SKirill Korotaev size_t *lenp, loff_t *ppos, 2420fcfbd547SKirill Korotaev unsigned long convmul, 2421fcfbd547SKirill Korotaev unsigned long convdiv) 2422fcfbd547SKirill Korotaev { 2423fcfbd547SKirill Korotaev return __do_proc_doulongvec_minmax(table->data, table, write, 24248d65af78SAlexey Dobriyan buffer, lenp, ppos, convmul, convdiv); 2425fcfbd547SKirill Korotaev } 2426fcfbd547SKirill Korotaev 24271da177e4SLinus Torvalds /** 24281da177e4SLinus Torvalds * proc_doulongvec_minmax - read a vector of long integers with min/max values 24291da177e4SLinus Torvalds * @table: the sysctl table 24301da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 24311da177e4SLinus Torvalds * @buffer: the user buffer 24321da177e4SLinus Torvalds * @lenp: the size of the user buffer 24331da177e4SLinus Torvalds * @ppos: file position 24341da177e4SLinus Torvalds * 24351da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 24361da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 24371da177e4SLinus Torvalds * 24381da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 24391da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 24401da177e4SLinus Torvalds * 24411da177e4SLinus Torvalds * Returns 0 on success. 24421da177e4SLinus Torvalds */ 24438d65af78SAlexey Dobriyan int proc_doulongvec_minmax(struct ctl_table *table, int write, 24441da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 24451da177e4SLinus Torvalds { 24468d65af78SAlexey Dobriyan return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); 24471da177e4SLinus Torvalds } 24481da177e4SLinus Torvalds 24491da177e4SLinus Torvalds /** 24501da177e4SLinus Torvalds * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values 24511da177e4SLinus Torvalds * @table: the sysctl table 24521da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 24531da177e4SLinus Torvalds * @buffer: the user buffer 24541da177e4SLinus Torvalds * @lenp: the size of the user buffer 24551da177e4SLinus Torvalds * @ppos: file position 24561da177e4SLinus Torvalds * 24571da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long 24581da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. The values 24591da177e4SLinus Torvalds * are treated as milliseconds, and converted to jiffies when they are stored. 24601da177e4SLinus Torvalds * 24611da177e4SLinus Torvalds * This routine will ensure the values are within the range specified by 24621da177e4SLinus Torvalds * table->extra1 (min) and table->extra2 (max). 24631da177e4SLinus Torvalds * 24641da177e4SLinus Torvalds * Returns 0 on success. 24651da177e4SLinus Torvalds */ 2466d8217f07SEric W. Biederman int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 24671da177e4SLinus Torvalds void __user *buffer, 24681da177e4SLinus Torvalds size_t *lenp, loff_t *ppos) 24691da177e4SLinus Torvalds { 24708d65af78SAlexey Dobriyan return do_proc_doulongvec_minmax(table, write, buffer, 24711da177e4SLinus Torvalds lenp, ppos, HZ, 1000l); 24721da177e4SLinus Torvalds } 24731da177e4SLinus Torvalds 24741da177e4SLinus Torvalds 24751da177e4SLinus Torvalds static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp, 24761da177e4SLinus Torvalds int *valp, 24771da177e4SLinus Torvalds int write, void *data) 24781da177e4SLinus Torvalds { 24791da177e4SLinus Torvalds if (write) { 2480cba9f33dSBart Samwel if (*lvalp > LONG_MAX / HZ) 2481cba9f33dSBart Samwel return 1; 24821da177e4SLinus Torvalds *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); 24831da177e4SLinus Torvalds } else { 24841da177e4SLinus Torvalds int val = *valp; 24851da177e4SLinus Torvalds unsigned long lval; 24861da177e4SLinus Torvalds if (val < 0) { 24871da177e4SLinus Torvalds *negp = -1; 24881da177e4SLinus Torvalds lval = (unsigned long)-val; 24891da177e4SLinus Torvalds } else { 24901da177e4SLinus Torvalds *negp = 0; 24911da177e4SLinus Torvalds lval = (unsigned long)val; 24921da177e4SLinus Torvalds } 24931da177e4SLinus Torvalds *lvalp = lval / HZ; 24941da177e4SLinus Torvalds } 24951da177e4SLinus Torvalds return 0; 24961da177e4SLinus Torvalds } 24971da177e4SLinus Torvalds 24981da177e4SLinus Torvalds static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, 24991da177e4SLinus Torvalds int *valp, 25001da177e4SLinus Torvalds int write, void *data) 25011da177e4SLinus Torvalds { 25021da177e4SLinus Torvalds if (write) { 2503cba9f33dSBart Samwel if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) 2504cba9f33dSBart Samwel return 1; 25051da177e4SLinus Torvalds *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); 25061da177e4SLinus Torvalds } else { 25071da177e4SLinus Torvalds int val = *valp; 25081da177e4SLinus Torvalds unsigned long lval; 25091da177e4SLinus Torvalds if (val < 0) { 25101da177e4SLinus Torvalds *negp = -1; 25111da177e4SLinus Torvalds lval = (unsigned long)-val; 25121da177e4SLinus Torvalds } else { 25131da177e4SLinus Torvalds *negp = 0; 25141da177e4SLinus Torvalds lval = (unsigned long)val; 25151da177e4SLinus Torvalds } 25161da177e4SLinus Torvalds *lvalp = jiffies_to_clock_t(lval); 25171da177e4SLinus Torvalds } 25181da177e4SLinus Torvalds return 0; 25191da177e4SLinus Torvalds } 25201da177e4SLinus Torvalds 25211da177e4SLinus Torvalds static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, 25221da177e4SLinus Torvalds int *valp, 25231da177e4SLinus Torvalds int write, void *data) 25241da177e4SLinus Torvalds { 25251da177e4SLinus Torvalds if (write) { 25261da177e4SLinus Torvalds *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); 25271da177e4SLinus Torvalds } else { 25281da177e4SLinus Torvalds int val = *valp; 25291da177e4SLinus Torvalds unsigned long lval; 25301da177e4SLinus Torvalds if (val < 0) { 25311da177e4SLinus Torvalds *negp = -1; 25321da177e4SLinus Torvalds lval = (unsigned long)-val; 25331da177e4SLinus Torvalds } else { 25341da177e4SLinus Torvalds *negp = 0; 25351da177e4SLinus Torvalds lval = (unsigned long)val; 25361da177e4SLinus Torvalds } 25371da177e4SLinus Torvalds *lvalp = jiffies_to_msecs(lval); 25381da177e4SLinus Torvalds } 25391da177e4SLinus Torvalds return 0; 25401da177e4SLinus Torvalds } 25411da177e4SLinus Torvalds 25421da177e4SLinus Torvalds /** 25431da177e4SLinus Torvalds * proc_dointvec_jiffies - read a vector of integers as seconds 25441da177e4SLinus Torvalds * @table: the sysctl table 25451da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25461da177e4SLinus Torvalds * @buffer: the user buffer 25471da177e4SLinus Torvalds * @lenp: the size of the user buffer 25481da177e4SLinus Torvalds * @ppos: file position 25491da177e4SLinus Torvalds * 25501da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25511da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25521da177e4SLinus Torvalds * The values read are assumed to be in seconds, and are converted into 25531da177e4SLinus Torvalds * jiffies. 25541da177e4SLinus Torvalds * 25551da177e4SLinus Torvalds * Returns 0 on success. 25561da177e4SLinus Torvalds */ 25578d65af78SAlexey Dobriyan int proc_dointvec_jiffies(struct ctl_table *table, int write, 25581da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 25591da177e4SLinus Torvalds { 25608d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 25611da177e4SLinus Torvalds do_proc_dointvec_jiffies_conv,NULL); 25621da177e4SLinus Torvalds } 25631da177e4SLinus Torvalds 25641da177e4SLinus Torvalds /** 25651da177e4SLinus Torvalds * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds 25661da177e4SLinus Torvalds * @table: the sysctl table 25671da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25681da177e4SLinus Torvalds * @buffer: the user buffer 25691da177e4SLinus Torvalds * @lenp: the size of the user buffer 25701e5d5331SRandy Dunlap * @ppos: pointer to the file position 25711da177e4SLinus Torvalds * 25721da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25731da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25741da177e4SLinus Torvalds * The values read are assumed to be in 1/USER_HZ seconds, and 25751da177e4SLinus Torvalds * are converted into jiffies. 25761da177e4SLinus Torvalds * 25771da177e4SLinus Torvalds * Returns 0 on success. 25781da177e4SLinus Torvalds */ 25798d65af78SAlexey Dobriyan int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 25801da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 25811da177e4SLinus Torvalds { 25828d65af78SAlexey Dobriyan return do_proc_dointvec(table,write,buffer,lenp,ppos, 25831da177e4SLinus Torvalds do_proc_dointvec_userhz_jiffies_conv,NULL); 25841da177e4SLinus Torvalds } 25851da177e4SLinus Torvalds 25861da177e4SLinus Torvalds /** 25871da177e4SLinus Torvalds * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds 25881da177e4SLinus Torvalds * @table: the sysctl table 25891da177e4SLinus Torvalds * @write: %TRUE if this is a write to the sysctl file 25901da177e4SLinus Torvalds * @buffer: the user buffer 25911da177e4SLinus Torvalds * @lenp: the size of the user buffer 259267be2dd1SMartin Waitz * @ppos: file position 259367be2dd1SMartin Waitz * @ppos: the current position in the file 25941da177e4SLinus Torvalds * 25951da177e4SLinus Torvalds * Reads/writes up to table->maxlen/sizeof(unsigned int) integer 25961da177e4SLinus Torvalds * values from/to the user buffer, treated as an ASCII string. 25971da177e4SLinus Torvalds * The values read are assumed to be in 1/1000 seconds, and 25981da177e4SLinus Torvalds * are converted into jiffies. 25991da177e4SLinus Torvalds * 26001da177e4SLinus Torvalds * Returns 0 on success. 26011da177e4SLinus Torvalds */ 26028d65af78SAlexey Dobriyan int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 26031da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26041da177e4SLinus Torvalds { 26058d65af78SAlexey Dobriyan return do_proc_dointvec(table, write, buffer, lenp, ppos, 26061da177e4SLinus Torvalds do_proc_dointvec_ms_jiffies_conv, NULL); 26071da177e4SLinus Torvalds } 26081da177e4SLinus Torvalds 26098d65af78SAlexey Dobriyan static int proc_do_cad_pid(struct ctl_table *table, int write, 26109ec52099SCedric Le Goater void __user *buffer, size_t *lenp, loff_t *ppos) 26119ec52099SCedric Le Goater { 26129ec52099SCedric Le Goater struct pid *new_pid; 26139ec52099SCedric Le Goater pid_t tmp; 26149ec52099SCedric Le Goater int r; 26159ec52099SCedric Le Goater 26166c5f3e7bSPavel Emelyanov tmp = pid_vnr(cad_pid); 26179ec52099SCedric Le Goater 26188d65af78SAlexey Dobriyan r = __do_proc_dointvec(&tmp, table, write, buffer, 26199ec52099SCedric Le Goater lenp, ppos, NULL, NULL); 26209ec52099SCedric Le Goater if (r || !write) 26219ec52099SCedric Le Goater return r; 26229ec52099SCedric Le Goater 26239ec52099SCedric Le Goater new_pid = find_get_pid(tmp); 26249ec52099SCedric Le Goater if (!new_pid) 26259ec52099SCedric Le Goater return -ESRCH; 26269ec52099SCedric Le Goater 26279ec52099SCedric Le Goater put_pid(xchg(&cad_pid, new_pid)); 26289ec52099SCedric Le Goater return 0; 26299ec52099SCedric Le Goater } 26309ec52099SCedric Le Goater 26311da177e4SLinus Torvalds #else /* CONFIG_PROC_FS */ 26321da177e4SLinus Torvalds 26338d65af78SAlexey Dobriyan int proc_dostring(struct ctl_table *table, int write, 26341da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26351da177e4SLinus Torvalds { 26361da177e4SLinus Torvalds return -ENOSYS; 26371da177e4SLinus Torvalds } 26381da177e4SLinus Torvalds 26398d65af78SAlexey Dobriyan int proc_dointvec(struct ctl_table *table, int write, 26401da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26411da177e4SLinus Torvalds { 26421da177e4SLinus Torvalds return -ENOSYS; 26431da177e4SLinus Torvalds } 26441da177e4SLinus Torvalds 26458d65af78SAlexey Dobriyan int proc_dointvec_minmax(struct ctl_table *table, int write, 26461da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26471da177e4SLinus Torvalds { 26481da177e4SLinus Torvalds return -ENOSYS; 26491da177e4SLinus Torvalds } 26501da177e4SLinus Torvalds 26518d65af78SAlexey Dobriyan int proc_dointvec_jiffies(struct ctl_table *table, int write, 26521da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26531da177e4SLinus Torvalds { 26541da177e4SLinus Torvalds return -ENOSYS; 26551da177e4SLinus Torvalds } 26561da177e4SLinus Torvalds 26578d65af78SAlexey Dobriyan int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, 26581da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26591da177e4SLinus Torvalds { 26601da177e4SLinus Torvalds return -ENOSYS; 26611da177e4SLinus Torvalds } 26621da177e4SLinus Torvalds 26638d65af78SAlexey Dobriyan int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, 26641da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26651da177e4SLinus Torvalds { 26661da177e4SLinus Torvalds return -ENOSYS; 26671da177e4SLinus Torvalds } 26681da177e4SLinus Torvalds 26698d65af78SAlexey Dobriyan int proc_doulongvec_minmax(struct ctl_table *table, int write, 26701da177e4SLinus Torvalds void __user *buffer, size_t *lenp, loff_t *ppos) 26711da177e4SLinus Torvalds { 26721da177e4SLinus Torvalds return -ENOSYS; 26731da177e4SLinus Torvalds } 26741da177e4SLinus Torvalds 2675d8217f07SEric W. Biederman int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 26761da177e4SLinus Torvalds void __user *buffer, 26771da177e4SLinus Torvalds size_t *lenp, loff_t *ppos) 26781da177e4SLinus Torvalds { 26791da177e4SLinus Torvalds return -ENOSYS; 26801da177e4SLinus Torvalds } 26811da177e4SLinus Torvalds 26821da177e4SLinus Torvalds 26831da177e4SLinus Torvalds #endif /* CONFIG_PROC_FS */ 26841da177e4SLinus Torvalds 26851da177e4SLinus Torvalds /* 26861da177e4SLinus Torvalds * No sense putting this after each symbol definition, twice, 26871da177e4SLinus Torvalds * exception granted :-) 26881da177e4SLinus Torvalds */ 26891da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec); 26901da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_jiffies); 26911da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_minmax); 26921da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); 26931da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dointvec_ms_jiffies); 26941da177e4SLinus Torvalds EXPORT_SYMBOL(proc_dostring); 26951da177e4SLinus Torvalds EXPORT_SYMBOL(proc_doulongvec_minmax); 26961da177e4SLinus Torvalds EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); 26971da177e4SLinus Torvalds EXPORT_SYMBOL(register_sysctl_table); 269829e796fdSEric W. Biederman EXPORT_SYMBOL(register_sysctl_paths); 26991da177e4SLinus Torvalds EXPORT_SYMBOL(unregister_sysctl_table); 2700