exec: Convert security_bprm_set_creds into security_bprm_repopulate_creds
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 14 May 2020 17:53:44 +0000 (12:53 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 21 May 2020 15:16:50 +0000 (10:16 -0500)
commit112b7147592e8f46bd1da4f961773e6d974f38a8
tree78da2d713b0bc074b1e7b9c77738e52e6aa2da75
parentb8bff599261c930630385ee21d3f98e7ce7d4843
exec: Convert security_bprm_set_creds into security_bprm_repopulate_creds

Rename bprm->cap_elevated to bprm->active_secureexec and initialize it
in prepare_binprm instead of in cap_bprm_set_creds.  Initializing
bprm->active_secureexec in prepare_binprm allows multiple
implementations of security_bprm_repopulate_creds to play nicely with
each other.

Rename security_bprm_set_creds to security_bprm_reopulate_creds to
emphasize that this path recomputes part of bprm->cred.  This
recomputation avoids the time of check vs time of use problems that
are inherent in unix #! interpreters.

In short two renames and a move in the location of initializing
bprm->active_secureexec.

Link: https://lkml.kernel.org/r/87o8qkzrxp.fsf_-_@x220.int.ebiederm.org
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/exec.c
include/linux/binfmts.h
include/linux/lsm_hook_defs.h
include/linux/lsm_hooks.h
include/linux/security.h
security/commoncap.c
security/security.c