[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with signals and illegal instructions in user mode

From: Peter Maydell
Subject: Re: Problems with signals and illegal instructions in user mode
Date: Fri, 10 Apr 2020 13:21:43 +0100

On Fri, 10 Apr 2020 at 12:19, Gabe Black <address@hidden> wrote:
> I've expanded my set of tests to know include a call mechanism that's based 
> on accesses to a special region of memory, and I'm having problems with that 
> too. I'm trying to use mprotect to block the pages that map to the magic 
> region so that when the utility attempts to access them, it will get a 
> SIGSEGV and I can look at what it tried to do.
> Running that test program natively on my x86 workstation works, but I have 
> problems when I run it for aarch64 in qemu. If I mprotect it with the 
> protection set to 0, it acts like it's not there at all (the si_code is for 
> an unmapped area, not access permissions), and if I mprotect it to have any 
> permissions at all, the magic read is allowed to happen without a SIGSEGV 
> even if there are no read permissions.
> Is this a fuzzy edge of the system calls QEMU can emulate? I'm hoping to be 
> able to use QEMU to run these test programs quickly with low overhead as part 
> of our test suite, but from my experience with a similar user mode in our own 
> simulator, I understand how getting all these details right can be very hard 
> and not always worth the trouble.

It's hard to say exactly what is going on without a test case, but I
suspect that we may not report the right si_code for unmapped
vs bad permissions. We should however report a SIGSEGV
of some kind for wrong-permissions.

SIGILL for illegal instructions should work: we use this for our
'risu' random-instruction tester:

Not all guest architectures in QEMU are supported to the
same 'quality level' (eg arm should be pretty solid, x86 is less
so, some of the minor architectures can be pretty flaky), so
where functionality requires guest-arch-specific support it may
be buggy. Again, hard to say for certain without specific test cases.
In particular, bugs in 32-bit or 64-bit arm guest handling are something
I'd be interested in fixing.

You don't say what QEMU version you're using: make sure you're using
the most recent QEMU version.

-- PMM
git grep

reply via email to

[Prev in Thread] Current Thread [Next in Thread]