* [PATCH] exec: clarify reasoning for euid/egid reset
@ 2016-04-12 16:44 Kees Cook
2016-04-12 16:54 ` Serge Hallyn
2016-04-12 17:18 ` David Howells
0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2016-04-12 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: David Howells, Serge Hallyn, Willy Tarreau, Alexander Viro,
linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] exec: clarify reasoning for euid/egid reset
2016-04-12 16:44 [PATCH] exec: clarify reasoning for euid/egid reset Kees Cook
@ 2016-04-12 16:54 ` Serge Hallyn
2016-04-12 17:18 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: Serge Hallyn @ 2016-04-12 16:54 UTC (permalink / raw)
To: Kees Cook
Cc: Linus Torvalds, David Howells, Willy Tarreau, Alexander Viro,
linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] exec: clarify reasoning for euid/egid reset
2016-04-12 16:44 [PATCH] exec: clarify reasoning for euid/egid reset Kees Cook
2016-04-12 16:54 ` Serge Hallyn
@ 2016-04-12 17:18 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2016-04-12 17:18 UTC (permalink / raw)
To: Kees Cook
Cc: dhowells, Linus Torvalds, Serge Hallyn, Willy Tarreau,
Alexander Viro, linux-kernel
Kees Cook <keescook@chromium.org> wrote:
> - /* 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();
I would further add that this is where we deal with setuid scripts.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-12 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-12 16:44 [PATCH] exec: clarify reasoning for euid/egid reset Kees Cook
2016-04-12 16:54 ` Serge Hallyn
2016-04-12 17:18 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox