Skip to content

linux-user elf parsing endianness issue (Invalid note in PT_GNU_PROPERTY)

When running a modern aarch64 binary on an s390x host using qemu-aarch64, the following is produced instead of binary execution:

qemu-aarch64: /lib/ld-linux-aarch64.so.1: Invalid note in PT_GNU_PROPERTY

This comes from linux-user/elfload.c:parse_elf_properties():

    if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 ||
        note.nhdr.n_namesz != NOTE_NAME_SZ ||
        note.data[3] != GNU0_MAGIC) {
        error_setg(errp, "Invalid note in PT_GNU_PROPERTY");
        return false;
    }

especially the note.data[3] != GNU0_MAGIC test. Adding printf reveals:

note.data[3]=0x554e47 GNU0_MAGIC=0x474e5500

GNU0_MAGIC is defined in the same file as const_le32('G' | 'N' << 8 | 'U' << 16). Removing const_le32 part from this definition fixes the issue.

It looks like other parts of this file expect host byte order in the elf data, while this particular place forces little-endian.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information