Re: [PATCH] sysctl: Allow /proc/sys without sys_sysctl

Andrew Morton
2006-07-11T08:05:51Z

On Tue, 11 Jul 2006 01:52:57 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> As far as I can tell we never use sys_sysctl so I never expect to see
> these messages. But if we do see these it means that there are user
> space applications that need to be fixed before we can safely
> remove sys_sysctl.
>
> Limited to only 5 messages in case something like glibc is using sys_sysctl.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
> kernel/sysctl.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 42610e6..b7f7dcb 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1303,9 +1303,15 @@ int do_sysctl(int __user *name, int nlen
>
> asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
> {
> + static int msg_count;
> struct __sysctl_args tmp;
> int error;
>
> + if (msg_count++ < 5)
> + printk(KERN_INFO
> + "warning: process `%s' used the obsolete sysctl "
> + "system call\n", current->comm);
> +
> if (copy_from_user(&tmp, args, sizeof(tmp)))
> return -EFAULT;

That'll print it five times per 4 billion calls ;)

> @@ -2688,6 +2694,12 @@ #else /* CONFIG_SYSCTL_SYSCALL */
>
> asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
> {
> + static int msg_count;
> +
> + if (msg_coutn++ < 5)

That'll have trouble compiling.

Go to bed, man. I'll fix it up.