qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	qemu-devel@nongnu.org, patches@linaro.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH for-1.1] user-exec.c: Don't assert on segfaults for non-valid addresses
Date: Tue, 08 May 2012 12:29:42 -0500	[thread overview]
Message-ID: <4FA95806.4020206@codemonkey.ws> (raw)
In-Reply-To: <1336069935-2106-1-git-send-email-peter.maydell@linaro.org>

On 05/03/2012 01:32 PM, Peter Maydell wrote:
> h2g() will assert if passed an address that's not a valid guest address,
> so handle_cpu_signal() needs to check before passing "data address
> which caused a segfault" to it, since for a misbehaving guest
> that could be anything. If the address isn't a valid guest address
> then we can simply skip the attempt to unprotect a guest page
> which was made read-only to catch self-modifying code.
>
> This assertion probably fires more readily now than it used to
> do because of recent changes to default to reserving guest address
> space.
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
> I've tentatively marked this as for-1.1 as it's pretty safe, although
> it doesn't buy you a great deal: misbehaving guest binaries will
> die cleanly with a segfault rather than qemu asserting and then
> locking up (assert() in qemu's linux-user code doesn't really behave
> very nicely...)
>
>   user-exec.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/user-exec.c b/user-exec.c
> index be6bc4f..d8c2ad9 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -97,7 +97,8 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
>                   pc, address, is_write, *(unsigned long *)old_set);
>   #endif
>       /* XXX: locking issue */
> -    if (is_write&&  page_unprotect(h2g(address), pc, puc)) {
> +    if (is_write&&  h2g_valid(address)
> +&&  page_unprotect(h2g(address), pc, puc)) {
>           return 1;
>       }
>

      parent reply	other threads:[~2012-05-08 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 18:32 [Qemu-devel] [PATCH for-1.1] user-exec.c: Don't assert on segfaults for non-valid addresses Peter Maydell
2012-05-03 18:33 ` Alexander Graf
2012-05-08 17:29 ` Anthony Liguori [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=4FA95806.4020206@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agraf@suse.de \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).