From: Oleg Nesterov <oleg@redhat.com>
To: Ben Woodard <woodard@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, roland@frob.com,
"Mark A. Grondona" <grondona1@llnl.gov>
Subject: Re: [PATCH] Fix child thread's introspection of /proc/self/exe
Date: Tue, 26 Mar 2013 12:13:35 +0100 [thread overview]
Message-ID: <20130326111335.GA23786@redhat.com> (raw)
In-Reply-To: <5150F5C0.70205@redhat.com>
On 03/25, Ben Woodard wrote:
>
> Allow threads other than the main thread to do introspection of files in
> proc without relying on read permissions. proc_pid_follow_link() calls
> proc_fd_access_allowed() which ultimately calls __ptrace_may_access().
>
> Though this allows additional access to some proc files, we do not
> believe that this has any unintended security implications. However it
> probably needs to be looked at carefully.
>
> The original problem was a thread of a process whose permissions were
> 111 couldn't open its own /proc/self/exe This was interfering with a
> special purpose debugging tool. A simple reproducer is below.:
To clarify, the test-case fails if the executable is not readable.
This is because setup_new_exec()->would_dump() notices that
inode_permission(MAY_READ) fails and then we do set_dumpable(suid_dumpable).
After that __ptrace_may_access()->get_dumpable() fails.
It is not clear why proc_pid_readlink/etc should check get_dumpable(),
perhaps we could add PTRACE_MODE_NODUMPABLE. But this is offtopic and
I think the patch is fine anyway.
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -234,7 +234,7 @@ static int __ptrace_may_access(struct task_struct
> *task, unsigned int mode)
> */
> int dumpable = 0;
> /* Don't let security modules deny introspection */
> - if (task == current)
> + if (same_thread_group(task, current))
> return 0;
> rcu_read_lock();
> tcred = __task_cred(task);
I agree. I think that any security checks are pointless in this case,
both tasks have the same ->mm.
Acked-by: Oleg Nesterov <oleg@redhat.com>
prev parent reply other threads:[~2013-03-26 11:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 1:11 [PATCH] Fix child thread's introspection of /proc/self/exe Ben Woodard
2013-03-26 11:13 ` Oleg Nesterov [this message]
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=20130326111335.GA23786@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=grondona1@llnl.gov \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@frob.com \
--cc=woodard@redhat.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.