Excerpts from Michael Tokarev's message of Fri Nov 14 12:56:46 +0100 2014:
> Control: tag -1 + patch pending
>
> > So the problem is quite interesting.
> >
> > There's a field in ELF header, byte #7, ELF_OSABI. All at least x86
> > binaries so far had this field = 0, which means OSABI_SYSV. But
> > static libraries produced by recent gcc/binutils has this field = 3,
> > which means OSABI_GNU ("with GNU extensions" as comment says). And
> > this OSABI=3 variant is not handled by our binfmt magic/mask pair.
> >
> > Now, this field (ELF_OSABI) is a enumeration, and we need to allow
> > either 0 or 3 in there, but not other variants, since this will
> > result in qemu trying to execute some clearly different-ABI binaries.
> > A somewhat too intrusive fix for a freeze, but I'll try.
>
> For now I just extended the mask to allow either 0, 1, 2 or 3 in this
> (ELF_OSABI) field. You can do it locally -- in /var/lib/binfmts/qemu-x86_64,
> change 7th byte (counting from 0) in the mask (the string which starts
> with \xff\xff...) from 0xff to 0xfb and re-run /etc/init.d/binfmt-support.
> After that, your static x86 binaries should at least try to work in qemu.
>
> Note again the bytes are counted from 0, not from 1. It should look
> like this:
>
> \xff\xff\xff\xff\xff\xfe\xfe\xfb\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
> 0 1 2 3 4 5 6 7 ^^
>
> Since I don't have access to arm box where I can verify this, can you
> please try this for me and tell if it fixes this issue?
Presumably you could add multiple magicks (in one file or in multiple
files if one cannot support them).
However, this does not seem to fix the issue:
root@sun5i:~# cdebootstrap-static
-bash: /usr/bin/cdebootstrap-static: cannot execute binary file: Exec
format error
root@sun5i:~# qemu-x86_64 /usr/bin/cdebootstrap-static
/usr/bin/cdebootstrap-static: missing suite argument
Try `/usr/bin/cdebootstrap-static --help' for more information.
root@sun5i:~# grep /usr/bin/qemu-x86_64 /var/lib/binfmts/*
/var/lib/binfmts/qemu-x86_64:/usr/bin/qemu-x86_64
root@sun5i:~# cat /var/lib/binfmts/qemu-x86_64
qemu-user-binfmt
magic
0
\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00
\xff\xff\xff\xff\xff\xfe\xfe\xfb\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
/usr/bin/qemu-x86_64
yes
Thanks
Michal
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]