Re: [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of
attacking
[Posted December 1, 2010 by corbet]
From: |
| Ingo Molnar <mingo-AT-elte.hu> |
To: |
| Linus Torvalds <torvalds-AT-linux-foundation.org> |
Subject: |
| Re: [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of
attacking |
Date: |
| Fri, 26 Nov 2010 08:48:09 +0100 |
Message-ID: |
| <20101126074809.GD19589@elte.hu> |
Cc: |
| Sarah Sharp <sarah.a.sharp-AT-linux.intel.com>,
Marcus Meissner <meissner-AT-suse.de>,
linux-kernel-AT-vger.kernel.org, tj-AT-kernel.org,
akpm-AT-linux-foundation.org, hpa-AT-zytor.com, w-AT-1wt.eu,
alan-AT-lxorguk.ukuu.org.uk |
Archive‑link: | |
Article |
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Fri, Nov 19, 2010 at 11:19 AM, Sarah Sharp
> <sarah.a.sharp@linux.intel.com> wrote:
> >
> > .config and dmesg are attached. The box is running klogd 1.5.5ubuntu3
> > (from Jaunty). Yes, I know that's old. I read the bit in the commit
> > about changing the permissions of kallsyms after boot, but if I can't
> > boot that doesn't help. Perhaps this can be made a configuration
> > option?
>
> It's not worth a config option.
>
> If it actually breaks user-space, I think we should just revert it.
Sarah,
Does your system boot fine if we make /proc/kallsyms simply an empty file to
unprivileged users? Something like the (untested ...) patch below.
Ingo
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 6f6d091..d54c993 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -465,7 +465,7 @@ static int s_show(struct seq_file *m, void *p)
struct kallsym_iter *iter = m->private;
/* Some debugging symbols have no name. Ignore them. */
- if (!iter->name[0])
+ if (!iter->name[0] || !capable(CAP_SYS_ADMIN))
return 0;
if (iter->module_name[0]) {