Skip to content

Commit

Permalink
[PATCH] Improve the removed sysctl warnings
Browse files Browse the repository at this point in the history
Don't warn about libpthread's access to kernel.version.  When it receives
-ENOSYS it will read /proc/sys/kernel/version.

If anything else shows up print the sysctl number string.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Cal Peake <cp@absolutedigital.net>
Cc: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Nov 6, 2006
1 parent 64efade commit 0e009be
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2680,13 +2680,33 @@ int sysctl_ms_jiffies(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;

/* 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;

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

Expand Down

0 comments on commit 0e009be

Please sign in to comment.