Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1554586

Re: SELinux lead to soft lockup when pid 1 proceess reap child

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: SELinux lead to soft lockup when pid 1 proceess reap child
Date 2017-01-09 19:30 +0100
Message-ID <sXMRI-7CY-13@gated-at.bofh.it> (permalink)
References <sXMI2-7zO-17@gated-at.bofh.it> <sXMI2-7zO-19@gated-at.bofh.it> <sXMI2-7zO-21@gated-at.bofh.it> <sXMI2-7zO-23@gated-at.bofh.it> <sXMI2-7zO-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Seriously, could someone explain why do we need the security_task_wait()
hook at all?


On 01/09, Oleg Nesterov wrote:
>
> On 01/09, yangshukui wrote:
> >
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -3596,6 +3596,9 @@ static int selinux_task_kill(struct task_struct *p,
> > struct siginfo *info,
> >
> >  static int selinux_task_wait(struct task_struct *p)
> >  {
> > +       if (pid_vnr(task_tgid(current)) == 1){
> > +                return 0;
> 
> this check is not really correct, it can be a sub-thread... Doesn't matter,
> please see below.
> 
> > +       }
> >         return task_has_perm(p, current, PROCESS__SIGCHLD);
> >  }
> > It work but it permit pid 1 process to reap child without selinux check. Can
> > we have a better way to handle this problem?
> 
> I never understood why security_task_wait() should deny to reap a child. But
> since it can we probably want some explicit "the whole namespace goes away" check.
> We could use, say, PIDNS_HASH_ADDING but I'd suggest something like a trivial change
> below for now.
> 
> Eric, what do you think?
> 
> Oleg.
> 
> diff --git a/security/security.c b/security/security.c
> index f825304..1330b4e 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -1027,6 +1027,9 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
>  
>  int security_task_wait(struct task_struct *p)
>  {
> +	/* must be the exiting child reaper */
> +	if (unlikely(current->flags & PF_EXITING))
> +		return 0;
>  	return call_int_hook(task_wait, 0, p);
>  }
>  

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: SELinux lead to soft lockup when pid 1 proceess reap child Oleg Nesterov <oleg@redhat.com> - 2017-01-09 19:20 +0100
  Re: SELinux lead to soft lockup when pid 1 proceess reap child Oleg Nesterov <oleg@redhat.com> - 2017-01-09 19:30 +0100
    Re: SELinux lead to soft lockup when pid 1 proceess reap child Stephen Smalley <sds@tycho.nsa.gov> - 2017-01-09 20:00 +0100
      Re: SELinux lead to soft lockup when pid 1 proceess reap child Paul Moore <paul@paul-moore.com> - 2017-01-10 00:50 +0100
      Re: SELinux lead to soft lockup when pid 1 proceess reap child Casey Schaufler <casey@schaufler-ca.com> - 2017-01-10 01:30 +0100

csiph-web