]> git.baikalelectronics.ru Git - kernel.git/commit
binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 12 Mar 2020 15:17:17 +0000 (10:17 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:46 +0000 (11:41 +0100)
commita2694a3c3e2e2dda034560c42fa7124f21843be6
tree1e2a391e83ee5e03a69155a0c99670fce9d5d876
parent1f185a73ed3509483eafdd141e4810ff1aa414a2
binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf

[ Upstream commit 02d99608a12ba8f9328ea834c1275fef7396dcc5 ]

In 2016 Linus moved install_exec_creds immediately after
setup_new_exec, in binfmt_elf as a cleanup and as part of closing a
potential information leak.

Perform the same cleanup for the other binary formats.

Different binary formats doing the same things the same way makes exec
easier to reason about and easier to maintain.

Greg Ungerer reports:
> I tested the the whole series on non-MMU m68k and non-MMU arm
> (exercising binfmt_flat) and it all tested out with no problems,
> so for the binfmt_flat changes:
Tested-by: Greg Ungerer <gerg@linux-m68k.org>
Ref: 7b091ee1c651 ("binfmt_elf: switch to new creds when switching to new mm")
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Stable-dep-of: 64042ead9f85 ("binfmt: Fix error return code in load_elf_fdpic_binary()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/ia32/ia32_aout.c
fs/binfmt_aout.c
fs/binfmt_elf_fdpic.c
fs/binfmt_flat.c