mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@osdl.org>
Cc: Cal Peake <cp@absolutedigital.net>,
	Linus Torvalds <torvalds@osdl.org>,
	Albert Cahalan <acahalan@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	ebiederm@xmission.com
Subject: [RFC] [PATCH] Improve the remove sysctl warnings.
Date: Wed, 18 Oct 2006 22:41:29 -0600	[thread overview]
Message-ID: <m17iyw7w92.fsf_-_@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20061018124415.e45ece22.akpm@osdl.org> (Andrew Morton's message of "Wed, 18 Oct 2006 12:44:15 -0700")


Andrew how does this look?

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>
---
 kernel/sysctl.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8020fb2..19124ee 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2676,13 +2676,33 @@ #else /* CONFIG_SYSCTL_SYSCALL */
 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;
 }
 
-- 
1.4.2.rc3.g7e18e-dirty


  parent reply	other threads:[~2006-10-19  4:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-18 18:23 sysctl Albert Cahalan
2006-10-18 18:27 ` sysctl David KOENIG
2006-10-18 18:31 ` sysctl Linus Torvalds
2006-10-18 18:52   ` sysctl Cal Peake
2006-10-18 19:12     ` sysctl Olaf Hering
2006-10-18 19:44     ` sysctl Andrew Morton
2006-10-18 21:06       ` sysctl Cal Peake
2006-10-19  4:41       ` Eric W. Biederman [this message]
2006-10-19 16:25         ` [RFC] [PATCH] Improve the remove sysctl warnings Cal Peake
2006-10-19 19:50           ` Alexey Dobriyan
2006-10-19 19:55             ` Cal Peake
2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
2006-10-20  7:35             ` Andrew Morton
2006-10-20 12:54               ` Eric W. Biederman
2006-10-20 16:39                 ` Andrew Morton
2006-10-21 10:23                   ` Eric W. Biederman
2006-10-20  7:52             ` Russell King
2006-10-20 14:38               ` Eric W. Biederman
2006-10-20 15:18                 ` Albert Cahalan
2006-10-21 10:53                   ` Eric W. Biederman
2006-10-20 15:46                 ` Bill Nottingham
2006-10-20  8:02             ` Jakub Jelinek
2006-10-20 13:41               ` Eric W. Biederman
2006-10-20 17:54             ` Marco Roeland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m17iyw7w92.fsf_-_@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=acahalan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=cp@absolutedigital.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®