From: Oleg Nesterov <oleg@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: Roland McGrath <roland@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>,
Hugh Dickins <hugh@veritas.com>
Subject: Re: ptrace && cred_exec_mutex (Was: [PATCH] ptrace: tracehook_unsafe_exec: remove the stale comment)
Date: Sat, 25 Apr 2009 19:25:24 +0200 [thread overview]
Message-ID: <20090425172524.GA3432@redhat.com> (raw)
In-Reply-To: <31842.1240656853@redhat.com>
On 04/25, David Howells wrote:
>
> Oleg Nesterov <oleg@redhat.com> wrote:
>
> > Yes. Except it looks like ->cred_exec_mutex is never used in fact.
>
> I must to be missing something... I see that:
>
> int ptrace_attach(struct task_struct *task)
> {
> ...
> /* Protect exec's credential calculations against our interference;
> * SUID, SGID and LSM creds get determined differently under ptrace.
> */
> retval = mutex_lock_interruptible(¤t->cred_exec_mutex);
> ...
> }
>
> And:
>
> int do_execve(...)
> {
> ...
> retval = mutex_lock_interruptible(¤t->cred_exec_mutex);
> if (retval < 0)
> goto out_free;
> ...
> }
Sorry David, I was very unclear.
These 2 current's are different tasks, and hence we take to unrelated locks.
We can never block taking current->cred_exec_mutex because nobody else
touches this mutex, we always use current. This means this lock is "nop".
Unless I missed something, ptrace_attach() should take task->cred_exec_mutex.
Oleg.
next prev parent reply other threads:[~2009-04-25 17:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 21:22 [PATCH] ptrace: tracehook_unsafe_exec: remove the stale comment Oleg Nesterov
2009-04-23 23:27 ` Roland McGrath
2009-04-24 16:39 ` ptrace && cred_exec_mutex (Was: [PATCH] ptrace: tracehook_unsafe_exec: remove the stale comment) Oleg Nesterov
2009-04-24 19:38 ` Roland McGrath
2009-04-25 10:54 ` David Howells
2009-04-25 17:25 ` Oleg Nesterov [this message]
2009-04-25 19:06 ` David Howells
2009-04-26 23:41 ` [PATCH] ptrace: ptrace_attach: fix the usage of ->cred_exec_mutex Oleg Nesterov
2009-04-27 2:11 ` Roland McGrath
2009-04-27 8:47 ` David Howells
2009-04-27 10:52 ` [GIT] " James Morris
2009-04-27 20:05 ` [PATCH] ptrace-tracehook_unsafe_exec-remove-the-stale-comment-fix Oleg Nesterov
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=20090425172524.GA3432@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=hugh@veritas.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox