All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: dhowells@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	James Morris <jmorris@namei.org>,
	Roland McGrath <roland@redhat.com>,
	Tom Horsley <tom.horsley@att.net>,
	linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH 1/1] exec: do not sleep in TASK_TRACED under ->cred_guard_mutex
Date: Fri, 04 Sep 2009 09:39:07 +0100	[thread overview]
Message-ID: <29983.1252053547@redhat.com> (raw)
In-Reply-To: <20090903160514.GA23646@redhat.com>

Oleg Nesterov <oleg@redhat.com> wrote:

> But I strongly believe we should blame another patch
> 
> 	"CRED: Make execve() take advantage of copy-on-write credentials"
> 	a6f76f23d297f70e2a6b3ec607f7aeeea9e37e8d
> 
> The tracee must not sleep in TASK_TRACED holding this mutex (it was named
> cred_exec_mutex). Even if we remove ->cred_guard_mutex from mm_for_maps()
> and proc_pid_attr_write(), another task doing PTRACE_ATTACH should not
> hang until it is killed or the tracee resumes.

Ummm...  I don't see how this is relevant.

Yes, a task must not sleep in TASK_TRACED if it is holding this mutex, but how
does that apply to do_exec(), mm_for_maps() or proc_pid_attr_write()?  A
process can't be in any of those three if it is in the TASK_TRACED state.

A process can only be in the TASK_TRACED state in one of two ways: its parent
moved it there from the TASK_STOPPED state, or it put itself in that state -
neither of which should apply here.

Apart from that, I've no objection to dropping the guard semaphore earlier.

I do think though, the problem is elsewhere.  Are we failing to unlock the
semaphore somewhere?  Or double locking it, I wonder?  Has Tom tried lockdep?

Btw, should mm_for_maps() use mutex_lock_interruptible()?  There doesn't seem
any point making it non-interruptible (except for kill signals) - unless that
would muck up seqfile handling.

> +int prepare_bprm_creds(struct linux_binprm *bprm)
> +{

__acquires()

> +void free_bprm(struct linux_binprm *bprm)
> +{

__releases()

  parent reply	other threads:[~2009-09-04  8:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 16:05 [PATCH 1/1] exec: do not sleep in TASK_TRACED under ->cred_guard_mutex Oleg Nesterov
2009-09-03 20:09 ` Roland McGrath
2009-09-04  8:43   ` David Howells
2009-09-04 13:39   ` Oleg Nesterov
2009-09-04 14:47     ` David Howells
2009-09-04 15:49       ` Oleg Nesterov
2009-09-04 17:26         ` [PATCH v3] " Oleg Nesterov
2009-09-04 19:42           ` Andrew Morton
2009-09-04 21:33             ` Oleg Nesterov
2009-09-09 21:57               ` Chuck Ebbert
2009-09-09 22:58                 ` Oleg Nesterov
2009-09-04  8:39 ` David Howells [this message]
2009-09-04  9:24   ` [PATCH 1/1] " Roland McGrath
2009-09-04 12:46   ` Oleg Nesterov
2009-09-04 13:39     ` David Howells
2009-09-04 13:55       ` 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=29983.1252053547@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=stable@kernel.org \
    --cc=tom.horsley@att.net \
    --cc=torvalds@linux-foundation.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 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.