Le 02/10/2024 à 11:11, Michael Tokarev a écrit :
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 <m...@tls.msk.ru>
---
  linux-user/elfload.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

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,

Reviewed-by: Laurent Vivier <laur...@vivier.eu>

Thanks,
Laurent

Reply via email to