qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@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 09:58:52 -0700	[thread overview]
Message-ID: <f8e98c93-394f-835a-4ec0-d21746bd9c2f@linaro.org> (raw)
In-Reply-To: <875zp49ocs.fsf@zen.linaroharston>

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.

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


r~


  reply	other threads:[~2019-06-17 17:02 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 [this message]
2019-06-17 18:10     ` Alex Bennée

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=f8e98c93-394f-835a-4ec0-d21746bd9c2f@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=christophe.lyon@linaro.org \
    --cc=qemu-devel@nongnu.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 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).