[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111009190022.GA13853@redhat.com>
Date: Sun, 9 Oct 2011 21:00:22 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Serge E. Hallyn" <serge.hallyn@...onical.com>
Cc: lkml <linux-kernel@...r.kernel.org>, richard@....at,
Andrew Morton <akpm@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Tejun Heo <tj@...nel.org>, serge@...lyn.com
Subject: Re: [PATCH] user namespace: make signal.c respect user namespaces
Sorry, I missed this email...
On 10/04, Serge E. Hallyn wrote:
>
> Quoting Oleg Nesterov (oleg@...hat.com):
> > --- x/kernel/signal.c
> > +++ x/kernel/signal.c
> > @@ -1019,6 +1019,27 @@ static inline int legacy_queue(struct si
> > return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
> > }
> >
> > +static inline fixup_uid(struct siginfo *info, struct task_struct *t)
> > +{
> > +#ifdef CONFIG_USER_NS
> > + if (current_user_ns() == task_cred_xxx(t, user_ns)))
> > +#endif
> > + return;
> > +
> > + if (SI_FROMKERNEL(info))
> > + switch (info->si_code & __SI_MASK) {
> > + default:
> > + return;
> > +
> > + case __SI_CHLD:
>
> If I'm reading this right, this will catch do_notify_parent, which is
> sending signals not from current.
Argh, indeed. So we need to modify the callers.
OTOH, this is only possible if the debugger notifies tracee->real_parent,
or we reparent to /sbin/init.
Anyways, yes, I forgot about this. Thanks.
Oleg.
Not sure of the best way to avoid
> this. For pids that case is being ignored by not using the __SI_MASK,
> so CLD_EXITED etc will cause from_ancestor_ns to be false. Could we
> do that here too, and then translate the pids in do_notify_parent?
>
> > + case __SI_MESGQ:
> > + break;
> > + }
> > +
> > + info->si_uid = user_ns_map_uid(task_cred_xxx(t, user_ns),
> > + current_cred(), info->si_uid);
> > +}
> > +
> > static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
> > int group, int from_ancestor_ns)
> > {
> > @@ -1088,6 +1109,9 @@ static int __send_signal(int sig, struct
> > q->info.si_pid = 0;
> > break;
> > }
> > +
> > + fixup_uid(info, t);
> > +
> > } else if (!is_si_special(info)) {
> > if (sig >= SIGRTMIN && info->si_code != SI_USER) {
> > /*
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists