diff options
author | Kees Cook <keescook@chromium.org> | 2017-07-18 18:25:31 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-08-01 15:03:10 -0400 |
commit | e37fdb785a5f95ecadf43b773c97f676500ac7b8 (patch) | |
tree | da2a0c619be4777fbfb33caf5078a9453782fd9d /fs/exec.c | |
parent | 2af622802696e1dbe28d81c8ea6355dc30800396 (diff) |
exec: Use secureexec for setting dumpability
The examination of "current" to decide dumpability is wrong. This was a
check of and euid/uid (or egid/gid) mismatch in the existing process,
not the newly created one. This appears to stretch back into even the
"history.git" tree. Luckily, dumpability is later set in commit_creds().
In earlier kernel versions before creds existed, similar checks also
existed late in the exec flow, covering up the mistake as far back as I
could find.
Note that because the commit_creds() check examines differences of euid,
uid, egid, gid, and capabilities between the old and new creds, it would
look like the setup_new_exec() dumpability test could be entirely removed.
However, the secureexec test may cover a different set of tests (specific
to the LSMs) than what commit_creds() checks for. So, fix this test to
use secureexec (the removed euid tests are redundant to the commoncap
secureexec checks now).
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Serge Hallyn <serge@hallyn.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1354,7 +1354,7 @@ void setup_new_exec(struct linux_binprm * bprm) | |||
1354 | 1354 | ||
1355 | current->sas_ss_sp = current->sas_ss_size = 0; | 1355 | current->sas_ss_sp = current->sas_ss_size = 0; |
1356 | 1356 | ||
1357 | if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid())) | 1357 | if (!bprm->secureexec) |
1358 | set_dumpable(current->mm, SUID_DUMP_USER); | 1358 | set_dumpable(current->mm, SUID_DUMP_USER); |
1359 | else | 1359 | else |
1360 | set_dumpable(current->mm, suid_dumpable); | 1360 | set_dumpable(current->mm, suid_dumpable); |