mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: jmorris@namei.org
Cc: dhowells@redhat.com, penguin-kernel@I-love.SAKURA.ne.jp,
	serue@us.ibm.com, haradats@gmail.com, k.takeda26@gmail.com,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] CRED: ptrace_attach() should use the target process's mutex
Date: Wed, 01 Oct 2008 16:38:26 +0100	[thread overview]
Message-ID: <20081001153823.9930.86648.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <200810012000.CGG73421.FQOHtLOJFVMOSF@I-love.SAKURA.ne.jp>

ptrace_attach() should use the target process's mutex when attaching to it,
not the current (tracer) process's mutex.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 kernel/ptrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 893a099..2ee343a 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -174,7 +174,7 @@ 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(&current->cred_exec_mutex);
+	retval = mutex_lock_interruptible(&task->cred_exec_mutex);
 	if (retval  < 0)
 		goto out;
 
@@ -218,7 +218,7 @@ repeat:
 bad:
 	write_unlock_irqrestore(&tasklist_lock, flags);
 	task_unlock(task);
-	mutex_unlock(&current->cred_exec_mutex);
+	mutex_unlock(&task->cred_exec_mutex);
 out:
 	return retval;
 }


       reply	other threads:[~2008-10-01 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200810012000.CGG73421.FQOHtLOJFVMOSF@I-love.SAKURA.ne.jp>
2008-10-01 15:38 ` David Howells [this message]
2008-10-01 23:23   ` James Morris
2008-10-02 10:52   ` Tetsuo Handa
2008-10-03  3:56     ` [PATCH] CRED: ptrace_attach() should use the target process\'s mutex Tetsuo Handa
2008-10-03 15:33     ` David Howells
2008-10-04 11:15       ` Tetsuo Handa

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=20081001153823.9930.86648.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=haradats@gmail.com \
    --cc=jmorris@namei.org \
    --cc=k.takeda26@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=serue@us.ibm.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

Powered by JetHome