public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Serge Hallyn <serge.hallyn@ubuntu.com>
To: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	David Howells <dhowells@redhat.com>, Willy Tarreau <w@1wt.eu>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exec: clarify reasoning for euid/egid reset
Date: Tue, 12 Apr 2016 16:54:52 +0000	[thread overview]
Message-ID: <20160412165452.GC19101@ubuntumail> (raw)
In-Reply-To: <20160412164428.GA1972@www.outflux.net>

Quoting Kees Cook (keescook@chromium.org):
> This section of code initially looks redundant, but is required. This
> improves the comment to explain more clearly why the reset is needed.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks, Kees.

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

> ---
>  fs/exec.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/exec.c b/fs/exec.c
> index c4010b8207a1..889221bbfdb3 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1387,7 +1387,12 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
>  	kuid_t uid;
>  	kgid_t gid;
>  
> -	/* clear any previous set[ug]id data from a previous binary */
> +	/*
> +	 * Since this can be called multiple times (via prepare_binprm),
> +	 * we must clear any previous work done when setting set[ug]id
> +	 * bits from any earlier bprm->file uses (for example when run
> +	 * first for a script then for its interpreter).
> +	 */
>  	bprm->cred->euid = current_euid();
>  	bprm->cred->egid = current_egid();
>  
> -- 
> 2.6.3
> 
> 
> -- 
> Kees Cook
> Chrome OS & Brillo Security

  reply	other threads:[~2016-04-12 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 16:44 [PATCH] exec: clarify reasoning for euid/egid reset Kees Cook
2016-04-12 16:54 ` Serge Hallyn [this message]
2016-04-12 17:18 ` David Howells

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=20160412165452.GC19101@ubuntumail \
    --to=serge.hallyn@ubuntu.com \
    --cc=dhowells@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=w@1wt.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox