diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2020-03-22 23:46:24 +0300 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2020-05-20 22:45:31 +0300 |
commit | b8bff599261c930630385ee21d3f98e7ce7d4843 (patch) | |
tree | abe467d5124f1df78e2d2383068c90f518a16069 /lib/crypto | |
parent | 87b047d2be417b271d80f5e490a825c6fd53ecad (diff) | |
download | linux-b8bff599261c930630385ee21d3f98e7ce7d4843.tar.xz |
exec: Factor security_bprm_creds_for_exec out of security_bprm_set_creds
Today security_bprm_set_creds has several implementations:
apparmor_bprm_set_creds, cap_bprm_set_creds, selinux_bprm_set_creds,
smack_bprm_set_creds, and tomoyo_bprm_set_creds.
Except for cap_bprm_set_creds they all test bprm->called_set_creds and
return immediately if it is true. The function cap_bprm_set_creds
ignores bprm->calld_sed_creds entirely.
Create a new LSM hook security_bprm_creds_for_exec that is called just
before prepare_binprm in __do_execve_file, resulting in a LSM hook
that is called exactly once for the entire of exec. Modify the bits
of security_bprm_set_creds that only want to be called once per exec
into security_bprm_creds_for_exec, leaving only cap_bprm_set_creds
behind.
Remove bprm->called_set_creds all of it's former users have been moved
to security_bprm_creds_for_exec.
Add or upate comments a appropriate to bring them up to date and
to reflect this change.
Link: https://lkml.kernel.org/r/87v9kszrzh.fsf_-_@x220.int.ebiederm.org
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Casey Schaufler <casey@schaufler-ca.com> # For the LSM and Smack bits
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'lib/crypto')
0 files changed, 0 insertions, 0 deletions