sysctl.c (3ee75ac3c0f4904633322b7d9b111566fbc4a7d3) sysctl.c (34f5a39899f3f3e815da64f48ddb72942d86c366)
1/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.

--- 137 unchanged lines hidden (view full) ---

146static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
147 void __user *oldval, size_t __user *oldlenp,
148 void __user *newval, size_t newlen);
149#endif
150
151#ifdef CONFIG_PROC_SYSCTL
152static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
153 void __user *buffer, size_t *lenp, loff_t *ppos);
1/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.

--- 137 unchanged lines hidden (view full) ---

146static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
147 void __user *oldval, size_t __user *oldlenp,
148 void __user *newval, size_t newlen);
149#endif
150
151#ifdef CONFIG_PROC_SYSCTL
152static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
153 void __user *buffer, size_t *lenp, loff_t *ppos);
154static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
155 void __user *buffer, size_t *lenp, loff_t *ppos);
154#endif
155
156static ctl_table root_table[];
157static struct ctl_table_header root_table_header =
158 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
159
160static ctl_table kern_table[];
161static ctl_table vm_table[];

--- 7 unchanged lines hidden (view full) ---

169#ifdef CONFIG_INOTIFY_USER
170extern ctl_table inotify_table[];
171#endif
172
173#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
174int sysctl_legacy_va_layout;
175#endif
176
156#endif
157
158static ctl_table root_table[];
159static struct ctl_table_header root_table_header =
160 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
161
162static ctl_table kern_table[];
163static ctl_table vm_table[];

--- 7 unchanged lines hidden (view full) ---

171#ifdef CONFIG_INOTIFY_USER
172extern ctl_table inotify_table[];
173#endif
174
175#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
176int sysctl_legacy_va_layout;
177#endif
178
179
177static void *get_uts(ctl_table *table, int write)
178{
179 char *which = table->data;
180#ifdef CONFIG_UTS_NS
181 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
182 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
183#endif
184 if (!write)

--- 154 unchanged lines hidden (view full) ---

339 .ctl_name = KERN_CORE_PATTERN,
340 .procname = "core_pattern",
341 .data = core_pattern,
342 .maxlen = 128,
343 .mode = 0644,
344 .proc_handler = &proc_dostring,
345 .strategy = &sysctl_string,
346 },
180static void *get_uts(ctl_table *table, int write)
181{
182 char *which = table->data;
183#ifdef CONFIG_UTS_NS
184 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
185 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
186#endif
187 if (!write)

--- 154 unchanged lines hidden (view full) ---

342 .ctl_name = KERN_CORE_PATTERN,
343 .procname = "core_pattern",
344 .data = core_pattern,
345 .maxlen = 128,
346 .mode = 0644,
347 .proc_handler = &proc_dostring,
348 .strategy = &sysctl_string,
349 },
350#ifdef CONFIG_PROC_SYSCTL
347 {
348 .ctl_name = KERN_TAINTED,
349 .procname = "tainted",
350 .data = &tainted,
351 .maxlen = sizeof(int),
351 {
352 .ctl_name = KERN_TAINTED,
353 .procname = "tainted",
354 .data = &tainted,
355 .maxlen = sizeof(int),
352 .mode = 0444,
353 .proc_handler = &proc_dointvec,
356 .mode = 0644,
357 .proc_handler = &proc_dointvec_taint,
354 },
358 },
359#endif
355 {
356 .ctl_name = KERN_CAP_BSET,
357 .procname = "cap-bound",
358 .data = &cap_bset,
359 .maxlen = sizeof(kernel_cap_t),
360 .mode = 0600,
361 .proc_handler = &proc_dointvec_bset,
362 },

--- 1559 unchanged lines hidden (view full) ---

1922 void __user *buffer, size_t *lenp, loff_t *ppos)
1923{
1924 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1925 NULL,NULL);
1926}
1927
1928#define OP_SET 0
1929#define OP_AND 1
360 {
361 .ctl_name = KERN_CAP_BSET,
362 .procname = "cap-bound",
363 .data = &cap_bset,
364 .maxlen = sizeof(kernel_cap_t),
365 .mode = 0600,
366 .proc_handler = &proc_dointvec_bset,
367 },

--- 1559 unchanged lines hidden (view full) ---

1927 void __user *buffer, size_t *lenp, loff_t *ppos)
1928{
1929 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1930 NULL,NULL);
1931}
1932
1933#define OP_SET 0
1934#define OP_AND 1
1935#define OP_OR 2
1930
1931static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1932 int *valp,
1933 int write, void *data)
1934{
1935 int op = *(int *)data;
1936 if (write) {
1937 int val = *negp ? -*lvalp : *lvalp;
1938 switch(op) {
1939 case OP_SET: *valp = val; break;
1940 case OP_AND: *valp &= val; break;
1936
1937static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1938 int *valp,
1939 int write, void *data)
1940{
1941 int op = *(int *)data;
1942 if (write) {
1943 int val = *negp ? -*lvalp : *lvalp;
1944 switch(op) {
1945 case OP_SET: *valp = val; break;
1946 case OP_AND: *valp &= val; break;
1947 case OP_OR: *valp |= val; break;
1941 }
1942 } else {
1943 int val = *valp;
1944 if (val < 0) {
1945 *negp = -1;
1946 *lvalp = (unsigned long)-val;
1947 } else {
1948 *negp = 0;

--- 16 unchanged lines hidden (view full) ---

1965 return -EPERM;
1966 }
1967
1968 op = is_init(current) ? OP_SET : OP_AND;
1969 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1970 do_proc_dointvec_bset_conv,&op);
1971}
1972
1948 }
1949 } else {
1950 int val = *valp;
1951 if (val < 0) {
1952 *negp = -1;
1953 *lvalp = (unsigned long)-val;
1954 } else {
1955 *negp = 0;

--- 16 unchanged lines hidden (view full) ---

1972 return -EPERM;
1973 }
1974
1975 op = is_init(current) ? OP_SET : OP_AND;
1976 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1977 do_proc_dointvec_bset_conv,&op);
1978}
1979
1980/*
1981 * Taint values can only be increased
1982 */
1983static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
1984 void __user *buffer, size_t *lenp, loff_t *ppos)
1985{
1986 int op;
1987
1988 if (!capable(CAP_SYS_ADMIN))
1989 return -EPERM;
1990
1991 op = OP_OR;
1992 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1993 do_proc_dointvec_bset_conv,&op);
1994}
1995
1973struct do_proc_dointvec_minmax_conv_param {
1974 int *min;
1975 int *max;
1976};
1977
1978static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1979 int *valp,
1980 int write, void *data)

--- 792 unchanged lines hidden ---
1996struct do_proc_dointvec_minmax_conv_param {
1997 int *min;
1998 int *max;
1999};
2000
2001static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2002 int *valp,
2003 int write, void *data)

--- 792 unchanged lines hidden ---