exec: Control flow simplifications
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest8 patches 36 repliesIn review
- v15 patches 30 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | exec: Teach prepare_exec_creds how exec treats uids & gidskernel/ | +3 | 3 replies | |
| 2/8 | exec: Factor security_bprm_creds_for_exec out of security_bprm_set_credsfs/ include/ include/ +9 more | +63 | 3 replies | |
| 3/8 | exec: Convert security_bprm_set_creds into security_bprm_repopulate_credsfs/ include/ include/ +4 more | +19 | 7 replies | |
| 4/8 | exec: Allow load_misc_binary to call prepare_binfmt unconditionallyfs/ fs/ include/ | +17 | 3 replies | |
| 5/8 | exec: Move the call of prepare_binprm into search_binary_handlerarch/ fs/ fs/ +3 more | +5 | 2 replies | |
| 6/8 | exec/binfmt_script: Don't modify bprm->buf and then return -ENOEXECfs/ | +38 | 2 replies | |
| 7/8 | exec: Generic execfd supportfs/ fs/ fs/ +2 more | +32 | 9 replies | |
| 8/8 | exec: Remove recursion from search_binary_handlerarch/ fs/ fs/ +3 more | +43 | 1 reply |
Reviews trailers per patch
All 8 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Casey Schaufler | Kees Cook | James Morris |
|---|---|---|---|
| Series | R-b R-b | ||
| 1/8 | R-b | ||
| 2/8 | A-b | R-b | |
| 3/8 | R-b | ||
| 4/8 | R-b | ||
| 5/8 | R-b | R-b | |
| 6/8 | R-b | ||
| 7/8 | R-b | ||
| 8/8 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v2 0/8] exec: Control flow simplifications
It is hard to follow the control flow in exec.c as the code has evolved over time and something that used to work one way now works another. This set of changes attempts to address the worst of that, to remove unnecessary work and to make the code a little easier to follow.
The churn is a bit higher than the last version of this patchset, with renaming and cleaning up of comments. I have split security_bprm_set_creds into security_bprm_creds_for_exec and security_bprm_repopulate_creds. My goal was to make it clear that one hook completes its work while the other recaculates it's work each time a new interpreter is selected.
I have added a new change at the beginning to make it clear that neither security_bprm_creds_for_exec nor security_bprm_repopulate_creds needs to be implemented as prepare_exec_creds properly does the work of setting up credentials unless something special is going on.
I have made the execfd support generic and moved out of binfmt_misc so that I can remove the recursion.
I have moved reassigning bprm->file into the loop that replaces the recursion. In doing so I discovered that binfmt_misc was naughty and was returning -ENOEXEC in such a way that the search_binary_handler loop could not continue. So I added a change to remove that naughtiness.
Eric W. Biederman (8):
exec: Teach prepare_exec_creds how exec treats uids & gids
exec: Factor security_bprm_creds_for_exec out of security_bprm_set_creds
exec: Convert security_bprm_set_creds into security_bprm_repopulate_creds
exec: Allow load_misc_binary to call prepare_binfmt unconditionally
exec: Move the call of prepare_binprm into search_binary_handler exec/binfmt_script: Don't modify bprm->buf and then return -ENOEXEC
exec: Generic execfd support
exec: Remove recursion from search_binary_handler
arch/alpha/kernel/binfmt_loader.c | 11 +---- fs/binfmt_elf.c | 4 +- fs/binfmt_elf_fdpic.c | 4 +- fs/binfmt_em86.c | 13 +---- fs/binfmt_misc.c | 69 ++++----------------------- fs/binfmt_script.c | 82 ++++++++++++++------------------ fs/exec.c | 97 ++++++++++++++++++++++++++------------ include/linux/binfmts.h | 36 ++++++-------- include/linux/lsm_hook_defs.h | 3 +- include/linux/lsm_hooks.h | 52 +++++++++++--------- include/linux/security.h | 14 ++++-- kernel/cred.c | 3 ++ security/apparmor/domain.c | 7 +-- security/apparmor/include/domain.h | 2 +- security/apparmor/lsm.c | 2 +- security/commoncap.c | 9 ++-- security/security.c | 9 +++- security/selinux/hooks.c | 8 ++-- security/smack/smack_lsm.c | 9 ++-- security/tomoyo/tomoyo.c | 12 ++--- 20 files changed, 202 insertions(+), 244 deletions(-)