On 22 March 2018 at 11:07, Laurent Vivier <[email protected]> wrote:
> Le 22/03/2018 à 12:05, Peter Maydell a écrit :
>> On 22 March 2018 at 10:36, Laurent Vivier <[email protected]> wrote:re.
>>> It goes wrong in this part:
>>>
>>> +     */
>>> +    if (is_write && info->si_signo == SIGSEGV && info->si_code ==
>>> SEGV_ACCERR &&
>>> +        h2g_valid(address)) {
>>>
>>> Because, on ppc, si_code is SEGV_MAPERR and not SEGV_ACCERR
>>> (on x86_64, si_code is SEGV_ACCERR as expected)
>>
>> So on PPC if you have a page mapped, and you access it with
>> the wrong permissions, you get SEGV_MAPERR? This seems like
>> a host kernel bug to me.
>
> Are we sure it is mapped? How to know?

We know it's mapped because the kernel doesn't give us the
SEGV_MAPERR code :-) Access to unmapped pages must be the
guest binary's problem -- the thing we're trying to detect
here is "is this a write access to a page that we mapped
read-only because we have a cache of code translated for it",
which is always going to be "mapped but not with the right
permissions".

thanks
-- PMM

Reply via email to