diff options
| author | Eric Paris <[email protected]> | 2008-11-04 20:18:26 +0000 |
|---|---|---|
| committer | James Morris <[email protected]> | 2008-11-04 21:44:11 +0000 |
| commit | 41d9f9c524a53477467b7e0111ff3d644198f191 (patch) | |
| tree | b891d648d756d7195bab5c0f55f105cd00d8f94a /security/selinux/hooks.c | |
| parent | SELinux: check open perms in dentry_open not inode_permission (diff) | |
| download | kernel-41d9f9c524a53477467b7e0111ff3d644198f191.tar.gz kernel-41d9f9c524a53477467b7e0111ff3d644198f191.zip | |
SELinux: hold tasklist_lock and siglock while waking wait_chldexit
SELinux has long been calling wake_up_interruptible() on
current->parent->signal->wait_chldexit without holding any locks. It
appears that this operation should hold the tasklist_lock to dereference
current->parent and we should hold the siglock when waking up the
signal->wait_chldexit.
Signed-off-by: Eric Paris <[email protected]>
Signed-off-by: James Morris <[email protected]>
Diffstat (limited to 'security/selinux/hooks.c')
| -rw-r--r-- | security/selinux/hooks.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 03ff7db2a2ca..5f21a514f581 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2268,7 +2268,9 @@ static void selinux_bprm_post_apply_creds(struct linux_binprm *bprm) struct rlimit *rlim, *initrlim; struct itimerval itimer; struct bprm_security_struct *bsec; + struct sighand_struct *psig; int rc, i; + unsigned long flags; tsec = current->security; bsec = bprm->security; @@ -2335,7 +2337,12 @@ static void selinux_bprm_post_apply_creds(struct linux_binprm *bprm) /* 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); } /* superblock security operations */ |
