mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
fs: binfmt_elf_efpic: don't use missing interpreter's properties
[ Upstream commit 15fd1dc3dadb4268207fa6797e753541aca09a2a ] Static FDPIC executable may get an executable stack even when it has non-executable GNU_STACK segment. This happens when STACK segment has rw permissions, but does not specify stack size. In that case FDPIC loader uses permissions of the interpreter's stack, and for static executables with no interpreter it results in choosing the arch-default permissions for the stack. Fix that by using the interpreter's properties only when the interpreter is actually used. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Link: https://lore.kernel.org/r/20240118150637.660461-1-jcmvbkbc@gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 8ca5b21fa9b2c13aad93a97992b92f9360988fe9) Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
This commit is contained in:
parent
4e2660eb12
commit
eba1af4c43
@ -324,7 +324,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
|
||||
else
|
||||
executable_stack = EXSTACK_DEFAULT;
|
||||
|
||||
if (stack_size == 0) {
|
||||
if (stack_size == 0 && interp_params.flags & ELF_FDPIC_FLAG_PRESENT) {
|
||||
stack_size = interp_params.stack_size;
|
||||
if (interp_params.flags & ELF_FDPIC_FLAG_EXEC_STACK)
|
||||
executable_stack = EXSTACK_ENABLE_X;
|
||||
|
Loading…
x
Reference in New Issue
Block a user