]> git.baikalelectronics.ru Git - kernel.git/commit
commoncap: Move cap_elevated calculation into bprm_set_creds
authorKees Cook <keescook@chromium.org>
Tue, 18 Jul 2017 22:25:28 +0000 (15:25 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 1 Aug 2017 19:03:09 +0000 (12:03 -0700)
commitee67ae7ef6ff499137292ac8a9dfe86096796283
tree6a23c8212426db697546ead1019325504f53114c
parent46d98eb4e1d2bc225f661879e0e157a952107598
commoncap: Move cap_elevated calculation into bprm_set_creds

Instead of a separate function, open-code the cap_elevated test, which
lets us entirely remove bprm->cap_effective (to use the local "effective"
variable instead), and more accurately examine euid/egid changes via the
existing local "is_setid".

The following LTP tests were run to validate the changes:

# ./runltp -f syscalls -s cap
# ./runltp -f securebits
# ./runltp -f cap_bounds
# ./runltp -f filecaps

All kernel selftests for capabilities and exec continue to pass as well.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: James Morris <james.l.morris@oracle.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
include/linux/binfmts.h
security/commoncap.c