Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1684031
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 3/8] exec: Use secureexec for setting dumpability |
| Date | 2017-07-10 10:00 +0200 |
| Message-ID | <u1BLQ-2bz-31@gated-at.bofh.it> (permalink) |
| References | <u1BLP-2bz-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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. 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, but strictly speaking, the secureexec test covers a different set of tests than what commit_creds() checks for. So, fix this test to use secureexec, which includes the same logical check (euid != uid || egid != gid), but checks bprm->cred, not current->cred. One would wonder if we need a security_commit_creds() LSM hook and to move the existing checks in commit_creds() into commoncaps.c, which would allow expanding the logic to all LSMs. Currently this doesn't seem needed, though. Signed-off-by: Kees Cook <keescook@chromium.org> --- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/exec.c b/fs/exec.c index b92e37fb53aa..3e519d4f0bd3 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1346,7 +1346,7 @@ void setup_new_exec(struct linux_binprm * bprm) current->sas_ss_sp = current->sas_ss_size = 0; - if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid())) + if (!bprm->secureexec) set_dumpable(current->mm, SUID_DUMP_USER); else set_dumpable(current->mm, suid_dumpable); -- 2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/8] exec: Use sane stack rlimit under secureexec Kees Cook <keescook@chromium.org> - 2017-07-10 10:00 +0200
[PATCH v2 2/8] exec: Move security_bprm_secureexec() earlier Kees Cook <keescook@chromium.org> - 2017-07-10 10:00 +0200
Re: [PATCH v2 2/8] exec: Move security_bprm_secureexec() earlier ebiederm@xmission.com (Eric W. Biederman) - 2017-07-10 11:10 +0200
Re: [PATCH v2 2/8] exec: Move security_bprm_secureexec() earlier Kees Cook <keescook@chromium.org> - 2017-07-10 18:10 +0200
Re: [PATCH v2 2/8] exec: Move security_bprm_secureexec() earlier Kees Cook <keescook@chromium.org> - 2017-07-11 04:10 +0200
Re: [PATCH v2 2/8] exec: Move security_bprm_secureexec() earlier Kees Cook <keescook@chromium.org> - 2017-07-18 08:50 +0200
[PATCH v2 6/8] exec: Consolidate dumpability logic Kees Cook <keescook@chromium.org> - 2017-07-10 10:00 +0200
[PATCH v2 3/8] exec: Use secureexec for setting dumpability Kees Cook <keescook@chromium.org> - 2017-07-10 10:00 +0200
[PATCH v2 4/8] exec: Use secureexec for clearing pdeath_signal Kees Cook <keescook@chromium.org> - 2017-07-10 10:10 +0200
csiph-web