Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1154687

Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user

From Helge Deller <deller@gmx.de>
Newsgroups linux.debian.bugs.dist
Subject Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user
Date 2023-07-17 22:40 +0200
Message-ID <GSDaF-VO6-19@gated-at.bofh.it> (permalink)
References (4 earlier) <GSBse-UGY-5@gated-at.bofh.it> <GSCHD-VEa-7@gated-at.bofh.it> <GSD0Z-VKQ-1@gated-at.bofh.it> <GRdih-2QS-3@gated-at.bofh.it> <GSD0Z-VKQ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 7/17/23 22:21, Michael Tokarev wrote:
> 17.07.2023 22:58, Helge Deller wrote:
>> This patch seems to work. Tested with qemu-arm and qemu-amd64.
>
> Wow!
>
>> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
>> index a26200d9f3..b583018591 100644
>> --- a/linux-user/elfload.c
>> +++ b/linux-user/elfload.c
>> @@ -3615,6 +3631,13 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
>>
>>       if (elf_interpreter) {
>>           load_elf_interp(elf_interpreter, &interp_info, bprm->buf);
>> +        /*
>> +         * adjust brk address if the interpreter was loaded above the main
>> +         * executable, e.g. happens with static binaries on armhf
>
> Guess you mean dynamic binaries?  the klibc binaries we used are dynamic, no?

Well, it's a static binary, but with dynamic interpreter:

deller@abel:~$ file fstype
fstype: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, interpreter /lib/klibc-m13AniKHUCMUNN8mXSUhIi8CUSA.so, BuildID[sha1]=127738bcbae6cad12468cc4182c9b289c3452864, stripped

>> +         */
>> +        if (interp_info.brk > info->brk) {
>> +            info->brk = interp_info.brk;
>> +        }
>
> Heh.  So it clashes with brk. Nice... ;)
>
> You should ping upstream about this one before 8.1 is out, I think.

I've queued up quite some other brk() fixes here:
https://github.com/hdeller/qemu-hppa/tree/upx-strace-fix-2
They hopefully fix all remaining issues.

Helge

Back to linux.debian.bugs.dist | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Helge Deller <deller@gmx.de> - 2023-07-17 15:00 +0200
  Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Michael Tokarev <mjt@tls.msk.ru> - 2023-07-17 15:30 +0200
    Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Helge Deller <deller@gmx.de> - 2023-07-17 20:40 +0200
      Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Helge Deller <deller@gmx.de> - 2023-07-17 20:50 +0200
        Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Helge Deller <deller@gmx.de> - 2023-07-17 22:10 +0200
          Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Michael Tokarev <mjt@tls.msk.ru> - 2023-07-17 22:30 +0200
            Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user Helge Deller <deller@gmx.de> - 2023-07-17 22:40 +0200

csiph-web