[klibc] qemu-user-static: mis-emulates something to do with process/signal handling (m68k, s390x, …)

Thorsten Glaser tg at mirbsd.de
Fri Jan 27 10:14:56 PST 2023


found 925358 1:7.2+dfsg-1+b2
thanks

Ben Hutchings dixit:

>and it certainly has been buggy on some architectures in the past.  It
>seems to be solid now on real hardware.

It probably is. All tests now pass on ARAnyM, even using the mksh
binary built under qemu-user-static (and failing tests there), so
it’s an emulation issue in qemu.

The easiest way to reproduce this locally is (in a sid chroot if
needed, so explicit invocation of qemu, not using binfmt-misc, as
that may use the host’s):

$ wget https://deb.debian.org/debian-ports/pool-m68k/main/m/mksh/mksh_59c-21_m68k.deb
$ sha256sum mksh_59c-21_m68k.deb
62df852fc4163b8fbda39bd6e06d146f1da18883789077a68ffa6d4b9562651a  mksh_59c-21_m68k.deb
$ paxtar xaf mksh_59c-21_m68k.deb
$ paxtar xaf data.tar.xz
$ chmod +x usr/lib/klibc/bin/mksh  # buildd chmod -x’s it if tests fail
$ /usr/bin/qemu-m68k-static usr/lib/klibc/bin/mksh -c 'echo hi'
hi
$ /usr/bin/qemu-m68k-static usr/lib/klibc/bin/mksh -c 'echo hi; /bin/echo hx; echo hy'
hi
hx
_

(it just sits there, ignores ^C, uses 100% CPU and needs kill -9)

I was able to re-verify this with the packaged version. In the meantime,
the precisely same binary passes every single test I can throw at it
when running under aranym 1.1.0-2 (kernel 5.16.11-1 but I’ve no doubt
upgrading that won’t change a thing).

>klibc's signal handling is probably a bit different from the others,

Nevertheless, given the other libcs work, I wonder whether it’d be
possible to work around the qemu bug in klibc… which requires figuring
out where it is of course, which is extra hard.

Various operating environments had this precise bug in the past, even
Haiku, who fixed this by patching their kernel. It seems to involve
signals not being sent after the child has exited and I have a hunch
it involves signals not being sent to the process when they were raised
while the process ignored them temporarily, if that helps… I have no
proof, not even hint, at hand for that, it just sits at the back of
the mind for some reason.

bye,
//mirabilos
-- 
<cnuke> den AGP stecker anfeilen, damit er in den slot aufm 440BX board passt…
oder netzteile, an die man auch den monitor angeschlossen hat und die dann für
ein elektrisch aufgeladenes gehäuse gesorgt haben […] für lacher gut auf jeder
LAN party │ <nvb> damals, als der pizzateig noch auf dem monior "gegangen" ist



More information about the klibc mailing list