All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Jürg Billeter" <j@bitron.ch>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"Michael Kerrisk" <mtk.manpages@gmail.com>,
	"Filipe Brandenburger" <filbranden@google.com>,
	"David Wilcox" <davidvsthegiant@gmail.com>,
	hansecke@gmail.com,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC
Date: Tue, 03 Oct 2017 11:36:25 -0500	[thread overview]
Message-ID: <87shf0b33q.fsf@xmission.com> (raw)
In-Reply-To: <CA+55aFz4FBarZhrbbASHcrS7SUgoiHh5A6t865XvA0SZyjxxnQ@mail.gmail.com> (Linus Torvalds's message of "Tue, 3 Oct 2017 09:10:04 -0700")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Tue, Oct 3, 2017 at 7:46 AM, Eric W. Biederman <ebiederm@xmission.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

  reply	other threads:[~2017-10-03 16:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09  9:40 [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Jürg Billeter
2017-09-12 17:05 ` Oleg Nesterov
2017-09-12 18:54   ` Jürg Billeter
2017-09-13 17:11     ` Oleg Nesterov
2017-09-13 17:26       ` Jürg Billeter
2017-09-13 17:48         ` Oleg Nesterov
2017-09-29 12:30 ` [RESEND PATCH] " Jürg Billeter
2017-10-02 23:20   ` Andrew Morton
2017-10-03  3:25     ` Eric W. Biederman
2017-10-03  6:45       ` Jürg Billeter
2017-10-03 14:46         ` Eric W. Biederman
2017-10-03 16:10           ` Linus Torvalds
2017-10-03 16:36             ` Eric W. Biederman [this message]
2017-10-03 17:02               ` Linus Torvalds
2017-10-03 19:30                 ` Eric W. Biederman
2017-10-03 20:02                   ` Linus Torvalds
2017-10-03 20:32                     ` Eric W. Biederman
2017-10-03 17:00           ` Jürg Billeter
2017-10-03 17:40             ` Eric W. Biederman
2017-10-03 17:47               ` Jürg Billeter
2017-10-03 19:05                 ` Eric W. Biederman
2017-10-05 16:27             ` Oleg Nesterov
2017-10-08 17:47               ` Jürg Billeter
2017-10-09 16:32                 ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shf0b33q.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidvsthegiant@gmail.com \
    --cc=filbranden@google.com \
    --cc=hansecke@gmail.com \
    --cc=j@bitron.ch \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=oleg@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.