Skip to content

Commit 9f834ec

Browse files
committed
binfmt_elf: switch to new creds when switching to new mm
We used to delay switching to the new credentials until after we had mapped the executable (and possible elf interpreter). That was kind of odd to begin with, since the new executable will actually then _run_ with the new creds, but whatever. The bigger problem was that we also want to make sure that we turn off prof events and tracing before we start mapping the new executable state. So while this is a cleanup, it's also a fix for a possible information leak. Reported-by: Robert Święcki <[email protected]> Tested-by: Peter Zijlstra <[email protected]> Acked-by: David Howells <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Acked-by: Andy Lutomirski <[email protected]> Acked-by: Eric W. Biederman <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: Kees Cook <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 61b5ebd commit 9f834ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/binfmt_elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
853853
current->flags |= PF_RANDOMIZE;
854854

855855
setup_new_exec(bprm);
856+
install_exec_creds(bprm);
856857

857858
/* Do this so that we can load the interpreter, if need be. We will
858859
change some of these later */
@@ -1044,7 +1045,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
10441045
goto out;
10451046
#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
10461047

1047-
install_exec_creds(bprm);
10481048
retval = create_elf_tables(bprm, &loc->elf_ex,
10491049
load_addr, interp_load_addr);
10501050
if (retval < 0)

0 commit comments

Comments
 (0)