aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2008-11-04 15:18:26 -0500
committerJames Morris <jmorris@namei.org>2008-11-04 16:44:11 -0500
commit41d9f9c524a53477467b7e0111ff3d644198f191 (patch)
treeb891d648d756d7195bab5c0f55f105cd00d8f94a /security/selinux
parent8b6a5a37f87a414ef8636e36ec75accb27bb7508 (diff)
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 <eparis@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c7
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)
2268 struct rlimit *rlim, *initrlim; 2268 struct rlimit *rlim, *initrlim;
2269 struct itimerval itimer; 2269 struct itimerval itimer;
2270 struct bprm_security_struct *bsec; 2270 struct bprm_security_struct *bsec;
2271 struct sighand_struct *psig;
2271 int rc, i; 2272 int rc, i;
2273 unsigned long flags;
2272 2274
2273 tsec = current->security; 2275 tsec = current->security;
2274 bsec = bprm->security; 2276 bsec = bprm->security;
@@ -2335,7 +2337,12 @@ static void selinux_bprm_post_apply_creds(struct linux_binprm *bprm)
2335 2337
2336 /* Wake up the parent if it is waiting so that it can 2338 /* Wake up the parent if it is waiting so that it can
2337 recheck wait permission to the new task SID. */ 2339 recheck wait permission to the new task SID. */
2340 read_lock_irq(&tasklist_lock);
2341 psig = current->parent->sighand;
2342 spin_lock_irqsave(&psig->siglock, flags);
2338 wake_up_interruptible(&current->parent->signal->wait_chldexit); 2343 wake_up_interruptible(&current->parent->signal->wait_chldexit);
2344 spin_unlock_irqrestore(&psig->siglock, flags);
2345 read_unlock_irq(&tasklist_lock);
2339} 2346}
2340 2347
2341/* superblock security operations */ 2348/* superblock security operations */