Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71162
b: refs/heads/master
c: 7058cb0
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Oct 18, 2007
1 parent 32c16e7 commit 7e11865
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ada720d89d678eb5a09d3048a5e9a35c526800c
refs/heads/master: 7058cb02ddab4bce70a46e519804fccb7ac0a060
35 changes: 35 additions & 0 deletions trunk/Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,41 @@ Who: Dominik Brodowski <linux@brodo.de>

---------------------------

What: sys_sysctl
When: September 2010
Option: CONFIG_SYSCTL_SYSCALL
Why: The same information is available in a more convenient from
/proc/sys, and none of the sysctl variables appear to be
important performance wise.

Binary sysctls are a long standing source of subtle kernel
bugs and security issues.

When I looked several months ago all I could find after
searching several distributions were 5 user space programs and
glibc (which falls back to /proc/sys) using this syscall.

The man page for sysctl(2) documents it as unusable for user
space programs.

sysctl(2) is not generally ABI compatible to a 32bit user
space application on a 64bit and a 32bit kernel.

For the last several months the policy has been no new binary
sysctls and no one has put forward an argument to use them.

Binary sysctls issues seem to keep happening appearing so
properly deprecating them (with a warning to user space) and a
2 year grace warning period will mean eventually we can kill
them and end the pain.

In the mean time individual binary sysctls can be dealt with
in a piecewise fashion.

Who: Eric Biederman <ebiederm@xmission.com>

---------------------------

What: a.out interpreter support for ELF executables
When: 2.6.25
Files: fs/binfmt_elf.c
Expand Down
64 changes: 41 additions & 23 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include <asm/stacktrace.h>
#endif

static int deprecated_sysctl_warning(struct __sysctl_args *args);

#if defined(CONFIG_SYSCTL)

/* External variables not in a header file. */
Expand Down Expand Up @@ -1347,10 +1349,15 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
if (copy_from_user(&tmp, args, sizeof(tmp)))
return -EFAULT;

error = deprecated_sysctl_warning(&tmp);
if (error)
goto out;

lock_kernel();
error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
tmp.newval, tmp.newlen);
unlock_kernel();
out:
return error;
}
#endif /* CONFIG_SYSCTL_SYSCALL */
Expand Down Expand Up @@ -2540,35 +2547,19 @@ int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,

asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
{
static int msg_count;
struct __sysctl_args tmp;
int name[CTL_MAXNAME];
int i;
int error;

/* Read in the sysctl name for better debug message logging */
if (copy_from_user(&tmp, args, sizeof(tmp)))
return -EFAULT;
if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
return -ENOTDIR;
for (i = 0; i < tmp.nlen; i++)
if (get_user(name[i], tmp.name + i))
return -EFAULT;

/* Ignore accesses to kernel.version */
if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
goto out;
error = deprecated_sysctl_warning(&tmp);

if (msg_count < 5) {
msg_count++;
printk(KERN_INFO
"warning: process `%s' used the removed sysctl "
"system call with ", current->comm);
for (i = 0; i < tmp.nlen; i++)
printk("%d.", name[i]);
printk("\n");
}
out:
return -ENOSYS;
/* If no error reading the parameters then just -ENOSYS ... */
if (!error)
error = -ENOSYS;

return error;
}

int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
Expand Down Expand Up @@ -2608,6 +2599,33 @@ int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,

#endif /* CONFIG_SYSCTL_SYSCALL */

static int deprecated_sysctl_warning(struct __sysctl_args *args)
{
static int msg_count;
int name[CTL_MAXNAME];
int i;

/* Read in the sysctl name for better debug message logging */
for (i = 0; i < args->nlen; i++)
if (get_user(name[i], args->name + i))
return -EFAULT;

/* Ignore accesses to kernel.version */
if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
return 0;

if (msg_count < 5) {
msg_count++;
printk(KERN_INFO
"warning: process `%s' used the deprecated sysctl "
"system call with ", current->comm);
for (i = 0; i < args->nlen; i++)
printk("%d.", name[i]);
printk("\n");
}
return 0;
}

/*
* No sense putting this after each symbol definition, twice,
* exception granted :-)
Expand Down

0 comments on commit 7e11865

Please sign in to comment.