From: Oleg Nesterov <oleg@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>,
Eric Paris <eparis@parisplace.org>,
James Morris <jmorris@namei.org>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: ptrace: selinux_bprm_committed_creds: simplify __wake_up_parent() code and s/parent/real_parent/
Date: Wed, 29 Apr 2009 16:02:24 +0200 [thread overview]
Message-ID: <20090429140224.GA31948@redhat.com> (raw)
In-Reply-To: <1241011116.18249.193.camel@localhost.localdomain>
(on top of David's "[PATCH] SELinux: Don't flush inherited SIGKILL during execve()",
but can be applied independently).
selinux_bprm_committed_creds() should wake up ->real_parent, not ->parent.
We shouldn't worry about the tracer if current is ptraced, exec() must not
succeed if the tracer has no rights to trace this task after cred changing.
But we should notify ->real_parent which is, well, real parent.
Also, we don't need _irq to take tasklist, and we don't need parent's
->siglock to wake_up_interruptible(real_parent->signal->wait_chldexit).
Since we hold tasklist, real_parent->signal must be stable. Otherwise
spin_lock(siglock) is not safe too and can't help anyway.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
--- PTRACE/security/selinux/hooks.c~SELINUX_PARENT 2009-04-29 15:45:28.000000000 +0200
+++ PTRACE/security/selinux/hooks.c 2009-04-29 15:48:41.000000000 +0200
@@ -2375,10 +2375,8 @@ static void selinux_bprm_committed_creds
{
const struct task_security_struct *tsec = current_security();
struct itimerval itimer;
- struct sighand_struct *psig;
u32 osid, sid;
int rc, i;
- unsigned long flags;
osid = tsec->osid;
sid = tsec->sid;
@@ -2409,12 +2407,9 @@ static void selinux_bprm_committed_creds
/* Wake up the parent if it is waiting so that it can recheck
* wait permission to the new task SID. */
- read_lock_irq(&tasklist_lock);
- psig = current->parent->sighand;
- spin_lock_irqsave(&psig->siglock, flags);
- wake_up_interruptible(¤t->parent->signal->wait_chldexit);
- spin_unlock_irqrestore(&psig->siglock, flags);
- read_unlock_irq(&tasklist_lock);
+ read_lock(&tasklist_lock);
+ wake_up_interruptible(¤t->real_parent->signal->wait_chldexit);
+ read_unlock(&tasklist_lock);
}
/* superblock security operations */
next prev parent reply other threads:[~2009-04-29 14:07 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 22:30 Q: selinux_bprm_committed_creds() && signals/do_wait Oleg Nesterov
2009-04-28 23:33 ` Oleg Nesterov
2009-04-29 16:01 ` [PATCH] do_wait: do take security_task_wait() into account Oleg Nesterov
2009-04-30 20:31 ` Roland McGrath
2009-04-30 22:51 ` James Morris
2009-05-06 11:46 ` Stephen Smalley
2009-04-29 0:29 ` Q: selinux_bprm_committed_creds() && signals/do_wait James Morris
2009-04-29 6:58 ` Oleg Nesterov
2009-04-29 10:02 ` David Howells
2009-04-29 10:25 ` Oleg Nesterov
2009-04-29 11:17 ` David Howells
2009-04-29 11:55 ` Oleg Nesterov
2009-04-29 12:42 ` David Howells
2009-04-29 12:45 ` David Howells
2009-04-29 13:28 ` Oleg Nesterov
2009-04-30 0:37 ` James Morris
2009-04-29 12:20 ` Stephen Smalley
2009-04-29 12:56 ` Oleg Nesterov
2009-04-29 13:16 ` Stephen Smalley
2009-04-29 13:42 ` Oleg Nesterov
2009-04-29 13:43 ` Stephen Smalley
2009-04-29 14:47 ` Alan Cox
2009-04-29 15:39 ` Stephen Smalley
2009-04-29 13:18 ` Stephen Smalley
2009-04-29 13:30 ` Oleg Nesterov
2009-04-29 14:02 ` Oleg Nesterov [this message]
2009-04-29 14:08 ` ptrace: selinux_bprm_committed_creds: simplify __wake_up_parent() code and s/parent/real_parent/ Oleg Nesterov
2009-04-30 22:44 ` Roland McGrath
2009-05-03 20:10 ` Oleg Nesterov
2009-05-04 17:38 ` Roland McGrath
2009-04-30 0:38 ` James Morris
2009-04-30 22:38 ` Roland McGrath
2009-04-29 14:48 ` Q: selinux_bprm_committed_creds() && signals/do_wait Alan Cox
2009-05-01 0:02 ` Roland McGrath
2009-05-01 0:44 ` David Howells
2009-05-01 0:50 ` Roland McGrath
2009-05-03 20:21 ` Oleg Nesterov
2009-05-04 17:34 ` 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=20090429140224.GA31948@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=eparis@parisplace.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=sds@tycho.nsa.gov \
/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.