qemu-mips illegal instruction [was readelf: Error: /usr/lib/libc.a: failed to skip archive symbol table]

Sean Bruno sbruno at ignoranthack.me
Fri Mar 28 18:00:35 UTC 2014


> This problem seems to be caused by a endian issue in qemu-mips.  Ed
> Maste found the culprit and I've applied it here:
> 
> https://github.com/seanbruno/qemu/commit/05ee8495804599b52a88eb36b13ea9c06b3207cd
> 
> Which is my combined tracking branch for qemu and sson's bsd-user
> branch.
> 
> I'm currently tracking an "illegal instruction" on exit issue that seems
> to happen on application exit causing a crash.
> 
> sean


I've been tracking qemu upstream with sson's patches and massaging
things here and there with the bsd-user mode qemu.

https://github.com/seanbruno/qemu/tree/bsd-user

That in combination with sson's kernelmod/userland tool allows me to
"chroot" into a mips environment suitable for building packages.
http://people.freebsd.org/~sson/imgact_binmisc/imgact_binmisc.diff

Currently, if I explicitly pass a shell into the chroot command, I have
no issues and all is well.  e.g.  chroot /mipsbuild /bin/sh

If I do not explicitly pass a shell, I get an illegal instruction core
dump from qemu-mips on exit from any command I run in the chroot:

chroot /mipsbuild
uname -a
<uname output>
(Illegal Instruction)[coredump]

This breaks poudriere right now.


More or less this is my recipe:
      - built a mips32 world for "chroot" purposes:
      - use sson's binmisc ELF interceptor thing:
      - run binmiscctl:
binmiscctl add mips32 --interpreter "/bin/qemu-mips" --magic "\x7f\x45
\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00
\x08" --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff
\xff\xff\xff\xfe\xff\xff" --size 20 --set-enabled


      - chroot /mipsbuild
      - uname -a (Illegal Instruction and coredump ON EXIT)

      - chroot /mipsbuild /bin/sh
      - uname -a (works everytime)


sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140328/fa85e259/attachment.sig>


More information about the freebsd-hackers mailing list