public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: David Howells <dhowells@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Q: PTRACE_ATTACH && -EINTR
Date: Mon, 8 Jun 2009 18:12:04 +0200	[thread overview]
Message-ID: <20090608161204.GA3986@redhat.com> (raw)

I just realized that ->cred_exec_mutex added a user-visible change
which may confuse user-space.

	ptrace_attach:

		retval = mutex_lock_interruptible(&task->cred_exec_mutex);
		if (retval  < 0)
			goto out;

This doesn't look good, we return -EINTR. Suppose that strace tries to
attach to all sub-threads and ptrace(PTRACE_ATTACH) returns -EINTR just
because the already traced thread sends SIGCHLD. Or tracer's sub-thread
does recalc_sigpending_and_wake().

I think we should at least do

		retval = -ERESTARTSYS;
		if (mutex_lock_interruptible(&task->cred_exec_mutex))
			goto out;

Or even -ERESTARTNOINTR ? Or just mutex_lock() ?

Or ignore this problem since nobody complained?

Oleg.


             reply	other threads:[~2009-06-08 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 16:12 Oleg Nesterov [this message]
2009-06-08 17:39 ` Q: PTRACE_ATTACH && -EINTR Roland McGrath
2009-06-08 18:36   ` Oleg Nesterov
2009-06-09  1:44     ` Roland McGrath
2009-06-10 13:11       ` Oleg Nesterov
2009-06-10 17:40         ` Roland McGrath
2009-06-19  0:38           ` [PATCH] cred_guard_mutex: do not return -EINTR to user-space Oleg Nesterov
2009-06-19  2:24             ` Roland McGrath

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=20090608161204.GA3986@redhat.com \
    --to=oleg@redhat.com \
    --cc=dhowells@redhat.com \
    --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