Skip to contentSkip to conversation

limit brk adjustment wrt interp.brk to arm32 only for now

PATCH In review Michael Tokarev 2 participants 2 messages Jul 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 limit brk adjustment wrt interp.brk to arm32 only for now

Commit 518f32221af7 "linux-user: Fix qemu-arm to run static armhf binaries" added brk value adjustment to interpreter brk value after loading the interpreter. Unfortunately this broke aarch64, ppc64el and s390x emulation, - the error which we had on armhf now happens on at least these 3 architectures. For the time being, limit the adjustment to aarch32 case only (where the prob originally observed), to be analyzed in more details later.

This is a quick band-aid, not a real fix.

---
 linux-user/elfload.c | 3 +++
 1 file changed, 3 insertions(+)
linux-user/elfload.c +3 -0
index 88c6861d7d..08e09b6863 100644
@@ -3617,15 +3617,18 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
     }
 
     if (elf_interpreter) {
         load_elf_interp(elf_interpreter, &interp_info, bprm->buf);
+#if defined(TARGET_ARM) && !defined(TARGET_AARCH64)
+/* FIXME: this breaks aarch64, ppc64el, s390x, hence the #if for now */
         /*
          * adjust brk address if the interpreter was loaded above the main
          * executable, e.g. happens with static binaries on armhf
          */
         if (interp_info.brk > info->brk) {
             info->brk = interp_info.brk;
         }
+#endif
 
         /* If the program interpreter is one of these two, then assume
            an iBCS2 image.  Otherwise assume a native linux image.  */
 
Signature · 1 line
2.39.2
#1 lore raw
Quoted 9 lines · Michael Tokarev

Commit 518f32221af7 "linux-user: Fix qemu-arm to run static armhf binaries" added brk value adjustment to interpreter brk value after loading the interpreter. Unfortunately this broke aarch64, ppc64el and s390x emulation, - the error which we had on armhf now happens on at least these 3 architectures. For the time being, limit the adjustment to aarch32 case only (where the prob originally observed), to be analyzed in more details later.

This is a quick band-aid, not a real fix.

I think if 518f32221af7 broke things we should revert it, not put in ifdefs.

thanks
-- PMM