diff mbox series

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

Message ID 20230722082616.3254040-1-mjt@tls.msk.ru
State New
Headers show
Series limit brk adjustment wrt interp.brk to arm32 only for now | expand

Commit Message

Michael Tokarev July 22, 2023, 8:26 a.m. UTC
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.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peter Maydell July 22, 2023, 11:21 a.m. UTC | #1
On Sat, 22 Jul 2023 at 09:26, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> 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
diff mbox series

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 88c6861d7d..08e09b6863 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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.  */