diff options
author | Kees Cook <keescook@chromium.org> | 2016-05-17 12:14:39 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-17 13:56:53 -0700 |
commit | cb6fd68fdd4a94880a99ad8515844c7a25e50d3e (patch) | |
tree | 766b14f48de74fcc5bac718599070fd3aab7fcee /fs/exec.c | |
parent | 7f427d3a6029331304f91ef4d7cf646f054216d2 (diff) | |
download | op-kernel-dev-cb6fd68fdd4a94880a99ad8515844c7a25e50d3e.zip op-kernel-dev-cb6fd68fdd4a94880a99ad8515844c7a25e50d3e.tar.gz |
exec: clarify reasoning for euid/egid reset
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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(); |