Message ID | 20241002091119.995467-1-mjt@tls.msk.ru |
---|---|
State | New |
Headers | show |
Series | linux-user/elfload.c: keep GNU0_MAGIC in host byte order | expand |
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 0678c9d506..1c54c556fc 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3028,7 +3028,7 @@ void probe_guest_base(const char *image_name, abi_ulong guest_loaddr, enum { /* The string "GNU\0" as a magic number. */ - GNU0_MAGIC = const_le32('G' | 'N' << 8 | 'U' << 16), + GNU0_MAGIC = 'G' | 'N' << 8 | 'U' << 16, NOTE_DATA_SZ = 1 * KiB, NOTE_NAME_SZ = 4, ELF_GNU_PROPERTY_ALIGN = ELF_CLASS == ELFCLASS32 ? 4 : 8,
Other places of this file operate in host byte order. Only this constant is defined as little-endian. This does not work, for example, on s390x host when running an arm64 binary: qemu-arm64: /usr/bin/busybox: Invalid note in PT_GNU_PROPERTY This change is tested on all combinations of host/guest for which debian provides release architectures, namely: amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x Fixes: v5.1.0-2580-g83f990eb5adb "linux-user/elfload: Parse NT_GNU_PROPERTY_TYPE_0 notes" Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2596 Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)