public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: David Howells <dhowells@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: Q: PTRACE_ATTACH && -EINTR
Date: Wed, 10 Jun 2009 15:11:16 +0200	[thread overview]
Message-ID: <20090610131116.GA10406@redhat.com> (raw)
In-Reply-To: <20090609014449.8BE46FC3C6@magilla.sf.frob.com>

On 06/08, Roland McGrath wrote:
>
> > It was renamed in -next. Should I send these fixes now for 2.6.20, or we can
> 								 30
> > wait for 2.6.31 ?
>
> IMHO they should go in ASAP since we know this is a regression just
> introduced in 2.6.29.  To me, the fact that nobody has noticed yet
> makes it more important not to delay--this new problem is so obscure
> that whoever is affected by it is likely to waste a lot of time figuring
> out what has started happening deep down in a huge pile of userland code.

2,6,30 is already released.

So, we need the trivial patch below, and perhaps a similar fix in
proc_pid_attr_write().

But giwen that ->cred_exec_mutex was renamed, I do not know where to send
this patch. This rename conflicts with ptrace changes in -mm, and the patch
below will add more confusion.

I'll wait until rename or -mm bits will be applied, then send this patch.
Fortunately the problem is not serious, ->cred_exec_mutex should be mostly
free.

Oleg.

--- T/fs/exec.c~	2009-05-24 21:46:20.000000000 +0200
+++ T/fs/exec.c	2009-06-10 14:58:27.000000000 +0200
@@ -1296,8 +1296,8 @@ int do_execve(char * filename,
 	if (!bprm)
 		goto out_files;
 
-	retval = mutex_lock_interruptible(&current->cred_exec_mutex);
-	if (retval < 0)
+	retval = -ERESTARTNOINTR;
+	if (mutex_lock_interruptible(&current->cred_exec_mutex))
 		goto out_free;
 	current->in_execve = 1;
 
--- T/kernel/ptrace.c~	2009-06-10 14:46:57.000000000 +0200
+++ T/kernel/ptrace.c	2009-06-10 14:54:24.000000000 +0200
@@ -189,8 +189,8 @@ int ptrace_attach(struct task_struct *ta
 	 * Protect exec's credential calculations against our interference;
 	 * SUID, SGID and LSM creds get determined differently under ptrace.
 	 */
-	retval = mutex_lock_interruptible(&task->cred_exec_mutex);
-	if (retval < 0)
+	retval = -ERESTARTNOINTR;
+	if (mutex_lock_interruptible(&task->cred_exec_mutex))
 		goto out;
 
 	task_lock(task);


  reply	other threads:[~2009-06-10 13:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 16:12 Q: PTRACE_ATTACH && -EINTR Oleg Nesterov
2009-06-08 17:39 ` Roland McGrath
2009-06-08 18:36   ` Oleg Nesterov
2009-06-09  1:44     ` Roland McGrath
2009-06-10 13:11       ` Oleg Nesterov [this message]
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=20090610131116.GA10406@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