Patch "fs: binfmt_elf_efpic: don't use missing interpreter's properties" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs: binfmt_elf_efpic: don't use missing interpreter's properties

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-binfmt_elf_efpic-don-t-use-missing-interpreter-s-.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 38adfae89db9aff7c657c54f43a06dbb66a09486
Author: Max Filippov <jcmvbkbc@xxxxxxxxx>
Date:   Thu Jan 18 07:06:37 2024 -0800

    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@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240118150637.660461-1-jcmvbkbc@xxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 48bb1290ed2fd..88428de9d873e 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -320,7 +320,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;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux