Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <robert@swiecki.net>
Tested-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -1
+1 -1
fs/binfmt_elf.c
··· 853 853 current->flags |= PF_RANDOMIZE; 854 854 855 855 setup_new_exec(bprm); 856 + install_exec_creds(bprm); 856 857 857 858 /* Do this so that we can load the interpreter, if need be. We will 858 859 change some of these later */ ··· 1045 1044 goto out; 1046 1045 #endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */ 1047 1046 1048 - install_exec_creds(bprm); 1049 1047 retval = create_elf_tables(bprm, &loc->elf_ex, 1050 1048 load_addr, interp_load_addr); 1051 1049 if (retval < 0)