diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-04-29 10:02:24 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-04-29 19:08:48 -0400 |
commit | ecd6de3c88e8cbcad175b2eab48ba05c2014f7b6 (patch) | |
tree | ab9257bbe3f3bc9379cf0d252110f9abffba7751 /security/selinux | |
parent | 3bcac0263f0b45e67a64034ebcb69eb9abb742f4 (diff) |
selinux: 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>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/hooks.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 5a345115036c..39046ddd90a9 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2371,10 +2371,8 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) | |||
2371 | { | 2371 | { |
2372 | const struct task_security_struct *tsec = current_security(); | 2372 | const struct task_security_struct *tsec = current_security(); |
2373 | struct itimerval itimer; | 2373 | struct itimerval itimer; |
2374 | struct sighand_struct *psig; | ||
2375 | u32 osid, sid; | 2374 | u32 osid, sid; |
2376 | int rc, i; | 2375 | int rc, i; |
2377 | unsigned long flags; | ||
2378 | 2376 | ||
2379 | osid = tsec->osid; | 2377 | osid = tsec->osid; |
2380 | sid = tsec->sid; | 2378 | sid = tsec->sid; |
@@ -2405,12 +2403,9 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) | |||
2405 | 2403 | ||
2406 | /* Wake up the parent if it is waiting so that it can recheck | 2404 | /* Wake up the parent if it is waiting so that it can recheck |
2407 | * wait permission to the new task SID. */ | 2405 | * wait permission to the new task SID. */ |
2408 | read_lock_irq(&tasklist_lock); | 2406 | read_lock(&tasklist_lock); |
2409 | psig = current->parent->sighand; | 2407 | wake_up_interruptible(¤t->real_parent->signal->wait_chldexit); |
2410 | spin_lock_irqsave(&psig->siglock, flags); | 2408 | read_unlock(&tasklist_lock); |
2411 | wake_up_interruptible(¤t->parent->signal->wait_chldexit); | ||
2412 | spin_unlock_irqrestore(&psig->siglock, flags); | ||
2413 | read_unlock_irq(&tasklist_lock); | ||
2414 | } | 2409 | } |
2415 | 2410 | ||
2416 | /* superblock security operations */ | 2411 | /* superblock security operations */ |