Skip to content

Commit 925346c

Browse files
rppttorvalds
authored andcommitted
fs/binfmt_elf: fix PT_LOAD p_align values for loaders
Rui Salvaterra reported that Aisleroit solitaire crashes with "Wrong __data_start/_end pair" assertion from libgc after update to v5.17-rc1. Bisection pointed to commit 9630f0d ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE") that fixed handling of static PIEs, but made the condition that guards load_bias calculation to exclude loader binaries. Restoring the check for presence of interpreter fixes the problem. Link: https://lkml.kernel.org/r/20220202121433.3697146-1-rppt@kernel.org Fixes: 9630f0d ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE") Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com> Tested-by: Rui Salvaterra <rsalvaterra@gmail.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Eric Biederman <ebiederm@xmission.com> Cc: "H.J. Lu" <hjl.tools@gmail.com> Cc: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f1baf68 commit 925346c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/binfmt_elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
11171117
* without MAP_FIXED nor MAP_FIXED_NOREPLACE).
11181118
*/
11191119
alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
1120-
if (alignment > ELF_MIN_ALIGN) {
1120+
if (interpreter || alignment > ELF_MIN_ALIGN) {
11211121
load_bias = ELF_ET_DYN_BASE;
11221122
if (current->flags & PF_RANDOMIZE)
11231123
load_bias += arch_mmap_rnd();

0 commit comments

Comments
 (0)