* [Qemu-devel] Looking for a linux-user mode test
@ 2016-12-28 15:06 Sean Bruno
2016-12-28 17:05 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Sean Bruno @ 2016-12-28 15:06 UTC (permalink / raw)
To: QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
After some recent-ish changes to how user mode executes things/stuff,
I'm running into issues with the out of tree bsd-user mode code that
FreeBSD has been maintaining. It looks like the host_signal_handler()
is never executed or registered correctly in our code. I'm curious if
the linux-user code can handle this bit of configure script from m4.
https://people.freebsd.org/~sbruno/stack.c
If someone has the time/inclination, can this code be compiled for ARMv6
and executed in a linux chroot with the -strace argument applied? I see
the following, which after much debugging seems to indicate that the
host_signal_handler() code is never executed as this code is requesting
that SIGSEGV be masked to its own handler.
https://people.freebsd.org/~sbruno/qemu-bsd-user-arm.txt
Prior to 7e6c57e2957c7d868f74bd0d53b5e861b495e1c7 this DTRT for our
ARMv6 targets.
sean
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Looking for a linux-user mode test
2016-12-28 15:06 [Qemu-devel] Looking for a linux-user mode test Sean Bruno
@ 2016-12-28 17:05 ` Peter Maydell
2016-12-28 17:12 ` Sean Bruno
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2016-12-28 17:05 UTC (permalink / raw)
To: Sean Bruno; +Cc: QEMU Developers
On 28 December 2016 at 15:06, Sean Bruno <sbruno@freebsd.org> wrote:
> After some recent-ish changes to how user mode executes things/stuff,
> I'm running into issues with the out of tree bsd-user mode code that
> FreeBSD has been maintaining. It looks like the host_signal_handler()
> is never executed or registered correctly in our code. I'm curious if
> the linux-user code can handle this bit of configure script from m4.
>
> https://people.freebsd.org/~sbruno/stack.c
Hmm. That code does:
* set up a SIGSEGV signal handler to run on its own stack
* go into an infinite recursion, expecting to run out of
stack and trigger a SEGV
which is a bit of an obscure corner case of signal handling.
We recently fixed a lot of signal handler related bugs in linux-user
by doing a significant overhaul of that code. If bsd-user is still
using the old broken approach it's probably still got lots of bugs
in it. Alternatively, it's possible we changed some of the core
code in that process and broke bsd-user by mistake.
Ideally all of that rework (including the support for properly
interrupting syscalls without races) should be ported over to
bsd-user at some point.
> If someone has the time/inclination, can this code be compiled for ARMv6
> and executed in a linux chroot with the -strace argument applied? I see
> the following, which after much debugging seems to indicate that the
> host_signal_handler() code is never executed as this code is requesting
> that SIGSEGV be masked to its own handler.
Built for ARMv7 since I don't have an ARMv6 cross compiler
or system, but it works ok for linux (also, built with -static
rather than run in a chroot, for convenience):
e104462:xenial:qemu$ ./build/arm-linux/arm-linux-user/qemu-arm -strace
~/linaro/qemu-misc-tests/stack
29798 uname(0xf6fff1f0) = 0
29798 brk(NULL) = 0x0007f000
29798 brk(0x0007fd00) = 0x0007fd00
29798 readlink("/proc/self/exe",0xf6ffe328,4096) = 43
29798 brk(0x000a0d00) = 0x000a0d00
29798 brk(0x000a1000) = 0x000a1000
29798 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
29798 sigaltstack(0xf6fff2e0,(nil)) = 0
29798 rt_sigaction(SIGSEGV,0xf6fff1b0,NULL) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=1, si_addr = 0xf67ffffc} ---
29798 exit_group(0)
(the enhancement to linux-user's strace to print the line on signal
delivery is also a pretty new change.)
> https://people.freebsd.org/~sbruno/qemu-bsd-user-arm.txt
>
> Prior to 7e6c57e2957c7d868f74bd0d53b5e861b495e1c7 this DTRT for our
> ARMv6 targets.
This commit hash doesn't seem to be in QEMU master.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Looking for a linux-user mode test
2016-12-28 17:05 ` Peter Maydell
@ 2016-12-28 17:12 ` Sean Bruno
2016-12-28 18:13 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Sean Bruno @ 2016-12-28 17:12 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]
On 12/28/16 10:05, Peter Maydell wrote:
> On 28 December 2016 at 15:06, Sean Bruno <sbruno@freebsd.org> wrote:
>> After some recent-ish changes to how user mode executes things/stuff,
>> I'm running into issues with the out of tree bsd-user mode code that
>> FreeBSD has been maintaining. It looks like the host_signal_handler()
>> is never executed or registered correctly in our code. I'm curious if
>> the linux-user code can handle this bit of configure script from m4.
>>
>> https://people.freebsd.org/~sbruno/stack.c
>
> Hmm. That code does:
> * set up a SIGSEGV signal handler to run on its own stack
> * go into an infinite recursion, expecting to run out of
> stack and trigger a SEGV
> which is a bit of an obscure corner case of signal handling.
>
> We recently fixed a lot of signal handler related bugs in linux-user
> by doing a significant overhaul of that code. If bsd-user is still
> using the old broken approach it's probably still got lots of bugs
> in it. Alternatively, it's possible we changed some of the core
> code in that process and broke bsd-user by mistake.
>
> Ideally all of that rework (including the support for properly
> interrupting syscalls without races) should be ported over to
> bsd-user at some point.
If you have a moment to point me at the merge commit that pulled in the
majority of this overhaul, I'll take a moment to review it for
application to bsd-user.
>
>> If someone has the time/inclination, can this code be compiled for ARMv6
>> and executed in a linux chroot with the -strace argument applied? I see
>> the following, which after much debugging seems to indicate that the
>> host_signal_handler() code is never executed as this code is requesting
>> that SIGSEGV be masked to its own handler.
>
> Built for ARMv7 since I don't have an ARMv6 cross compiler
> or system, but it works ok for linux (also, built with -static
> rather than run in a chroot, for convenience):
>
> e104462:xenial:qemu$ ./build/arm-linux/arm-linux-user/qemu-arm -strace
> ~/linaro/qemu-misc-tests/stack
> 29798 uname(0xf6fff1f0) = 0
> 29798 brk(NULL) = 0x0007f000
> 29798 brk(0x0007fd00) = 0x0007fd00
> 29798 readlink("/proc/self/exe",0xf6ffe328,4096) = 43
> 29798 brk(0x000a0d00) = 0x000a0d00
> 29798 brk(0x000a1000) = 0x000a1000
> 29798 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
> 29798 sigaltstack(0xf6fff2e0,(nil)) = 0
> 29798 rt_sigaction(SIGSEGV,0xf6fff1b0,NULL) = 0
> --- SIGSEGV {si_signo=SIGSEGV, si_code=1, si_addr = 0xf67ffffc} ---
> 29798 exit_group(0)
>
> (the enhancement to linux-user's strace to print the line on signal
> delivery is also a pretty new change.)
>
Thanks. This is what I expect to see.
>> https://people.freebsd.org/~sbruno/qemu-bsd-user-arm.txt
>>
>> Prior to 7e6c57e2957c7d868f74bd0d53b5e861b495e1c7 this DTRT for our
>> ARMv6 targets.
>
> This commit hash doesn't seem to be in QEMU master.
>
*sigh* ... that was the merge commit to the bsd-user branch I maintain.
Ignore it.
> thanks
> -- PMM
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Looking for a linux-user mode test
2016-12-28 17:12 ` Sean Bruno
@ 2016-12-28 18:13 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-12-28 18:13 UTC (permalink / raw)
To: Sean Bruno; +Cc: QEMU Developers
On 28 December 2016 at 17:12, Sean Bruno <sbruno@freebsd.org> wrote:
> On 12/28/16 10:05, Peter Maydell wrote:
>> Ideally all of that rework (including the support for properly
>> interrupting syscalls without races) should be ported over to
>> bsd-user at some point.
>
> If you have a moment to point me at the merge commit that pulled in the
> majority of this overhaul, I'll take a moment to review it for
> application to bsd-user.
Merges 430da7a81d356e3, 3e904d6ade7f36, b66e10e4c9ae7,
d6550e9ed2e1a60 (listed here latest first but probably more
helpfully examined the other way round) have the bulk of it,
there are probably some bugfixes that got in via other merges.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-28 18:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-28 15:06 [Qemu-devel] Looking for a linux-user mode test Sean Bruno
2016-12-28 17:05 ` Peter Maydell
2016-12-28 17:12 ` Sean Bruno
2016-12-28 18:13 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).