Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1402539 > unrolled thread
| Started by | Kees Cook <keescook@chromium.org> |
|---|---|
| First post | 2016-05-17 21:20 +0200 |
| Last post | 2016-05-17 23:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] exec: clarify reasoning for euid/egid reset Kees Cook <keescook@chromium.org> - 2016-05-17 21:20 +0200
Re: [PATCH v2] exec: clarify reasoning for euid/egid reset Linus Torvalds <torvalds@linux-foundation.org> - 2016-05-17 23:00 +0200
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2016-05-17 21:20 +0200 |
| Subject | [PATCH v2] exec: clarify reasoning for euid/egid reset |
| Message-ID | <rzSH7-aP-5@gated-at.bofh.it> |
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> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> --- v2: - clarified example as a setuid script, dhowells --- fs/exec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/exec.c b/fs/exec.c index c4010b8207a1..a98b21d47385 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 setuid script then again for its interpreter). + */ bprm->cred->euid = current_euid(); bprm->cred->egid = current_egid(); -- 2.6.3 -- Kees Cook Chrome OS & Brillo Security
[toc] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2016-05-17 23:00 +0200 |
| Message-ID | <rzUfT-ZV-7@gated-at.bofh.it> |
| In reply to | #1402539 |
On Tue, May 17, 2016 at 12:14 PM, Kees Cook <keescook@chromium.org> wrote:
> This section of code initially looks redundant, but is required. This
> improves the comment to explain more clearly why the reset is needed.
Applied.
Linus
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web