Skip to content

Commit

Permalink
SELinux: always check SIGCHLD in selinux_task_wait
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Paris authored and James Morris committed Oct 22, 2007
1 parent 55b70a0 commit 8a53514
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2977,11 +2977,7 @@ static int selinux_task_prctl(int option,

static int selinux_task_wait(struct task_struct *p)
{
u32 perm;

perm = signal_to_av(p->exit_signal);

return task_has_perm(p, current, perm);
return task_has_perm(p, current, PROCESS__SIGCHLD);
}

static void selinux_task_reparent_to_init(struct task_struct *p)
Expand Down

0 comments on commit 8a53514

Please sign in to comment.