[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87shf0b33q.fsf@xmission.com>
Date: Tue, 03 Oct 2017 11:36:25 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jürg Billeter <j@...ron.ch>,
Andrew Morton <akpm@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Filipe Brandenburger <filbranden@...gle.com>,
David Wilcox <davidvsthegiant@...il.com>, hansecke@...il.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RESEND PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC
Linus Torvalds <torvalds@...ux-foundation.org> writes:
> On Tue, Oct 3, 2017 at 7:46 AM, Eric W. Biederman <ebiederm@...ssion.com> wrote:
>>
>> The process that requests the signal be sent is the process that is
>> receiving the signal. I can see a theoretical need for a permission
>> check in there somewhere (especially as this persists over fork).
>
> Note that it also persists over not just fork, but execve() too.
>
> Yes, the signal is cleared if the e[ug]id/fs[ug]id is changed by exec,
> but not (for example) if just uid is changed.
*Scratches head*
pdeath_signal is cleared during exec if bprm->cap_elevated.
bprm->cap_elevated is set if we are not root and we gain caps during the exec.
bprm->cap_elevated is set if is_setid is true.
is_setid is set if the uid != eid or gid != egid.
So looking at that I am not exactly wild about the name cap_elevated,
but it seems to clear pdeath_signal if the jus the uid is changed during
exec.
> Does that matter? Probably not. But signal handling does actually
> check uid, so it does actually affect signal permission checks across
> execve.
I don't think there is anything in exec in this case to worry about.
Of course there is the completely bizarre case that if the parent execs
or calls setresuid it is possible that the signal won't send because it
is the parent's permission that are checked. I think that is probably
a bug.
I can understand not sending to our future self if our future self has
different credentials than our present self. But not sending to our
future self because someone else changed seems completely bizarre to me.
Eric
Powered by blists - more mailing lists