diff options
author | Eric Paris <eparis@redhat.com> | 2007-10-22 16:10:31 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2007-10-22 18:47:48 -0400 |
commit | 8a53514043e380aa573baa805298a7727c993985 (patch) | |
tree | 869d2c0f90390814430fc6639914dc8ea4c0c9c6 | |
parent | 55b70a0300b873c0ec7ea6e33752af56f41250ce (diff) |
SELinux: always check SIGCHLD in selinux_task_wait
When checking if we can wait on a child we were looking at
p->exit_signal and trying to make the decision based on if the signal
would eventually be allowed. One big flaw is that p->exit_signal is -1
for NPTL threads and so aignal_to_av was not actually checking SIGCHLD
which is what would have been sent. Even is exit_signal was set to
something strange it wouldn't change the fact that the child was there
and needed to be waited on. This patch just assumes wait is based on
SIGCHLD. Specific permission checks are made when the child actually
attempts to send a signal.
This resolves the problem of things like using GDB on confined domains
such as in RH BZ 232371. The confined domain did not have permission to
send a generic signal (exit_signal == -1) back to the unconfined GDB.
With this patch the GDB wait works and since the actual signal sent is
allowed everything functions as it should.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r-- | security/selinux/hooks.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 24e1b1885de7..9f3124b08867 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2977,11 +2977,7 @@ static int selinux_task_prctl(int option, | |||
2977 | 2977 | ||
2978 | static int selinux_task_wait(struct task_struct *p) | 2978 | static int selinux_task_wait(struct task_struct *p) |
2979 | { | 2979 | { |
2980 | u32 perm; | 2980 | return task_has_perm(p, current, PROCESS__SIGCHLD); |
2981 | |||
2982 | perm = signal_to_av(p->exit_signal); | ||
2983 | |||
2984 | return task_has_perm(p, current, perm); | ||
2985 | } | 2981 | } |
2986 | 2982 | ||
2987 | static void selinux_task_reparent_to_init(struct task_struct *p) | 2983 | static void selinux_task_reparent_to_init(struct task_struct *p) |