From: Al Viro <viro@ZenIV.linux.org.uk>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
kernel-hardening@lists.openwall.com,
linux-kernel@vger.kernel.org, Hugh Dickins <hughd@google.com>
Subject: [kernel-hardening] Re: [PATCH -next] proc: fix task_struct infoleak
Date: Sun, 11 Dec 2011 20:59:39 +0000 [thread overview]
Message-ID: <20111211205939.GH2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20111211182821.GA2853@albatros>
On Sun, Dec 11, 2011 at 10:28:21PM +0400, Vasiliy Kulikov wrote:
> proc_pid_permission() doesn't put task_struct on every /proc/$pid/
> access. A demo from Hugh Dickins:
>
> while :; do ps; grep KernelStack /proc/meminfo; sleep 1; done
>
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
> This is a patch against a hidepid patchset from -mm.
Choose saner commit summary, please. It's not information leak, for pity sake
- it's a plain and simple memory leak...
Speaking of which, I've a couple of memory leaks in mainline procfs and
mqueue; Alexey, are you OK with that sucker going directly to Linus or
would you rather push it yourself? See the patch below...
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 9a8a2b7..03102d9 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = {
void __init proc_root_init(void)
{
- struct vfsmount *mnt;
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
- mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
- if (IS_ERR(mnt)) {
+ err = pid_ns_prepare_proc(&init_pid_ns);
+ if (err) {
unregister_filesystem(&proc_fs_type);
return;
}
- init_pid_ns.proc_mnt = mnt;
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
@@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
void pid_ns_release_proc(struct pid_namespace *ns)
{
- mntput(ns->proc_mnt);
+ kern_unmount(ns->proc_mnt);
}
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
kernel-hardening@lists.openwall.com,
linux-kernel@vger.kernel.org, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH -next] proc: fix task_struct infoleak
Date: Sun, 11 Dec 2011 20:59:39 +0000 [thread overview]
Message-ID: <20111211205939.GH2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20111211182821.GA2853@albatros>
On Sun, Dec 11, 2011 at 10:28:21PM +0400, Vasiliy Kulikov wrote:
> proc_pid_permission() doesn't put task_struct on every /proc/$pid/
> access. A demo from Hugh Dickins:
>
> while :; do ps; grep KernelStack /proc/meminfo; sleep 1; done
>
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
> This is a patch against a hidepid patchset from -mm.
Choose saner commit summary, please. It's not information leak, for pity sake
- it's a plain and simple memory leak...
Speaking of which, I've a couple of memory leaks in mainline procfs and
mqueue; Alexey, are you OK with that sucker going directly to Linus or
would you rather push it yourself? See the patch below...
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 9a8a2b7..03102d9 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = {
void __init proc_root_init(void)
{
- struct vfsmount *mnt;
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
- mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
- if (IS_ERR(mnt)) {
+ err = pid_ns_prepare_proc(&init_pid_ns);
+ if (err) {
unregister_filesystem(&proc_fs_type);
return;
}
- init_pid_ns.proc_mnt = mnt;
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
@@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
void pid_ns_release_proc(struct pid_namespace *ns)
{
- mntput(ns->proc_mnt);
+ kern_unmount(ns->proc_mnt);
}
next prev parent reply other threads:[~2011-12-11 20:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-11 18:28 [kernel-hardening] [PATCH -next] proc: fix task_struct infoleak Vasiliy Kulikov
2011-12-11 18:28 ` Vasiliy Kulikov
2011-12-11 20:59 ` Al Viro [this message]
2011-12-11 20:59 ` Al Viro
2011-12-12 11:31 ` [kernel-hardening] " Vasiliy Kulikov
2011-12-12 11:31 ` Vasiliy Kulikov
2011-12-11 23:20 ` [kernel-hardening] " Hugh Dickins
2011-12-11 23:20 ` Hugh Dickins
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=20111211205939.GH2203@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=segoon@openwall.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.