[lkml]   [2019]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.16 200/202] binfmt_elf: switch to new creds when switching to new mm
3.16.66-rc1 review patch.  If anyone has any objections, please let me know.


From: Linus Torvalds <>

commit 9f834ec18defc369d73ccf9e87a2790bfa05bf46 upstream.

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 <>
Tested-by: Peter Zijlstra <>
Acked-by: David Howells <>
Acked-by: Oleg Nesterov <>
Acked-by: Andy Lutomirski <>
Acked-by: Eric W. Biederman <>
Cc: Willy Tarreau <>
Cc: Kees Cook <>
Cc: Al Viro <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Ben Hutchings <>
fs/binfmt_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -736,6 +736,7 @@ static int load_elf_binary(struct linux_
current->flags |= PF_RANDOMIZE;

+ install_exec_creds(bprm);

/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
@@ -951,7 +952,6 @@ static int load_elf_binary(struct linux_

- install_exec_creds(bprm);
retval = create_elf_tables(bprm, &loc->elf_ex,
load_addr, interp_load_addr);
if (retval < 0) {
 \ /
  Last update: 2019-04-27 17:29    [W:0.490 / U:2.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site