All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: christophe.lyon@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] tcg: Fix mmap lock assert on translation failure
Date: Mon, 17 Jun 2019 19:10:28 +0100	[thread overview]
Message-ID: <874l4o9j6z.fsf@zen.linaroharston> (raw)
In-Reply-To: <f8e98c93-394f-835a-4ec0-d21746bd9c2f@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> On 6/17/19 9:18 AM, Alex Bennée wrote:
>>
>> Richard Henderson <richard.henderson@linaro.org> writes:
>>
>>> Check page flags before letting an invalid pc cause a SIGSEGV.
>>>
>>> Prepare for eventially validating PROT_EXEC.  The current wrinkle being
>>> that we have a problem with our implementation of signals.  We should
>>> be using a vdso like the kernel, but we instead put the trampoline on
>>> the stack.  In the meantime, let PROT_READ match PROT_EXEC.
>>
>> We can come up with a test case for this right? Would it be triggered by
>> having:
>>
>> __attribute__((aligned(PAGE_SIZE)))
>> void some_func(void) {
>>      /* does something */
>> }
>>
>> __attribute__((aligned(PAGE_SIZE)))
>> ... rest of code ...
>>
>> main () {
>>      mmap(&some_func, PAGE_SIZE, PROT_READ, MAP_ANONYMOUS, 0, 0);
>>      some_func()
>>      /* causes SEGV */
>>      mmap(&some_func, PAGE_SIZE, PROT_READ|PROT_EXEC, MAP_ANONYMOUS, 0, 0);
>>      some_func()
>>      /* works */
>> }
>>
>> Or is it trickier to mess with your own mapped memory?
>
> It's trickier than that, but I do have a simple test case.
>
>   https://bugs.launchpad.net/qemu/+bug/1832916
>
> But fixing that, as I mention above, makes signal trampolines fail.

Ahh I missed that. I guess we add it once we have the full solution.

>
> Or did you mean for Christophe's failure?  That's easier -- just make a NULL
> function call.
>
>
> r~


--
Alex Bennée


      reply	other threads:[~2019-06-17 18:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16 21:05 [Qemu-devel] [PATCH] tcg: Fix mmap lock assert on translation failure Richard Henderson
2019-06-17 12:41 ` Christophe Lyon
2019-06-17 16:18 ` Alex Bennée
2019-06-17 16:58   ` Richard Henderson
2019-06-17 18:10     ` Alex Bennée [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l4o9j6z.fsf@zen.linaroharston \
    --to=alex.bennee@linaro.org \
    --cc=christophe.lyon@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.