public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Roland McGrath <roland@redhat.com>, Oleg Nesterov <oleg@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ptrace: kill BKL in ptrace syscall
Date: Sun, 28 Mar 2010 23:45:16 +0200	[thread overview]
Message-ID: <20100328214515.GG5116@nowhere> (raw)
In-Reply-To: <1269812331-8511-1-git-send-regression-fweisbec@gmail.com>

On Sun, Mar 28, 2010 at 11:38:51PM +0200, Frederic Weisbecker wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The comment suggests that this usage is stale. There is no bkl in the
> exec path so if there is a race lurking there, the bkl in ptrace is
> not going to help in this regard.
> 
> Overview of the possibility of "accidental" races this bkl might
> protect:
> 
> - ptrace_traceme() is protected against task removal and concurrent
> read/write on current->ptrace as it locks write tasklist_lock.
> 
> - arch_ptrace_attach() is serialized by ptrace_traceme() against
> concurrent PTRACE_TRACEME or PTRACE_ATTACH
> 
> - ptrace_attach() is protected the same way ptrace_traceme() and
> in turn serializes arch_ptrace_attach()
> 
> - ptrace_check_attach() does its own well described serializing too.
> 
> There is no obvious race here.


And the call to arch_ptrace() doesn't need any pushdown I think,
since this is serialized by nature as there is only one "ptracer"
for a task.



> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
>  kernel/ptrace.c |   10 ----------
>  1 files changed, 0 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/ptrace.c b/kernel/ptrace.c
> index 42ad8ae..5357502 100644
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -666,10 +666,6 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
>  	struct task_struct *child;
>  	long ret;
>  
> -	/*
> -	 * This lock_kernel fixes a subtle race with suid exec
> -	 */
> -	lock_kernel();
>  	if (request == PTRACE_TRACEME) {
>  		ret = ptrace_traceme();
>  		if (!ret)
> @@ -703,7 +699,6 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
>   out_put_task_struct:
>  	put_task_struct(child);
>   out:
> -	unlock_kernel();
>  	return ret;
>  }
>  
> @@ -813,10 +808,6 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
>  	struct task_struct *child;
>  	long ret;
>  
> -	/*
> -	 * This lock_kernel fixes a subtle race with suid exec
> -	 */
> -	lock_kernel();
>  	if (request == PTRACE_TRACEME) {
>  		ret = ptrace_traceme();
>  		goto out;
> @@ -846,7 +837,6 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
>   out_put_task_struct:
>  	put_task_struct(child);
>   out:
> -	unlock_kernel();
>  	return ret;
>  }
>  #endif	/* CONFIG_COMPAT */
> -- 
> 1.6.2.3
> 


  reply	other threads:[~2010-03-28 21:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-28 21:38 [PATCH] ptrace: kill BKL in ptrace syscall Frederic Weisbecker
2010-03-28 21:45 ` Frederic Weisbecker [this message]
2010-03-29 11:40 ` Oleg Nesterov
2010-03-29 12:06   ` John Kacur
2010-03-29 13:05     ` Oleg Nesterov
2010-03-29 13:26       ` John Kacur
2010-03-29 18:22         ` Frederic Weisbecker
2010-03-29 18:35           ` Oleg Nesterov
2010-03-29 18:46             ` Frederic Weisbecker
2010-04-01 18:48             ` Frederic Weisbecker
2010-04-12 20:29               ` Andrew Morton
2010-04-12 20:32                 ` Frederic Weisbecker
2010-04-12 23:56                 ` Stephen Rothwell
2010-04-09 21:43   ` 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=20100328214515.GG5116@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --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