[PATCH] Improve the removed sysctl warnings

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>

authored by Eric W. Biederman and committed by Linus Torvalds 0e009be8 64efade1

+21 -1
+21 -1
kernel/sysctl.c
··· 2680 asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 2681 { 2682 static int msg_count; 2683 2684 if (msg_count < 5) { 2685 msg_count++; 2686 printk(KERN_INFO 2687 "warning: process `%s' used the removed sysctl " 2688 - "system call\n", current->comm); 2689 } 2690 return -ENOSYS; 2691 } 2692
··· 2680 asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 2681 { 2682 static int msg_count; 2683 + struct __sysctl_args tmp; 2684 + int name[CTL_MAXNAME]; 2685 + int i; 2686 + 2687 + /* Read in the sysctl name for better debug message logging */ 2688 + if (copy_from_user(&tmp, args, sizeof(tmp))) 2689 + return -EFAULT; 2690 + if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME) 2691 + return -ENOTDIR; 2692 + for (i = 0; i < tmp.nlen; i++) 2693 + if (get_user(name[i], tmp.name + i)) 2694 + return -EFAULT; 2695 + 2696 + /* Ignore accesses to kernel.version */ 2697 + if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION)) 2698 + goto out; 2699 2700 if (msg_count < 5) { 2701 msg_count++; 2702 printk(KERN_INFO 2703 "warning: process `%s' used the removed sysctl " 2704 + "system call with ", current->comm); 2705 + for (i = 0; i < tmp.nlen; i++) 2706 + printk("%d.", name[i]); 2707 + printk("\n"); 2708 } 2709 + out: 2710 return -ENOSYS; 2711 } 2712