qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Michael Matz" <matz@suse.de>,
	patches@linaro.org, "Dann Frazier" <dann.frazier@canonical.com>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Alexander Graf" <agraf@suse.de>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH 0/2] linux-user: Don't allow guest to block SIGSEGV
Date: Fri, 14 Mar 2014 14:36:53 +0000	[thread overview]
Message-ID: <1394807816-14514-1-git-send-email-peter.maydell@linaro.org> (raw)

QEMU uses SIGSEGV for its own purposes (notably for detection of guest
writes to pages marked read-only because we have cached translated code
from them), so allowing the guest to block SIGSEGV is a bad idea.
Instead we wrap sigprocmask() uses for guest-derived signal masks and
just track whether the guest thinks SIGSEGV is blocked rather than
really blocking it.

This is an updated version of a patchset sent by Alex Barcelo a
year or so ago; changes are:
 * use the wrapper for sigprocmask uses in signal.c where we set
   the signal mask on entry and exit from a guest signal handler
 * rather than just dropping SIGSEGV from the signal mask, track
   the guest state in a TaskState flag

Although the need for this patchset is more noticable with AArch64
guests (because at the moment we use trampoline code on the stack
for handling return from signal, which means that pages in the stack
are often marked read-only because we translate the trampoline code
and then written to in the normal course of guest execution) it
is generally applicable to all architectures.

[Eventually we should implement emulation of the vdso for AArch64,
at which point we can put the signal-return trampoline in that,
as the real kernel does; then there will be less of these SEGVs.]

Alex Barcelo (1):
  linux-user: Add wrapper for guest uses of sigprocmask function

Peter Maydell (1):
  linux-user: Don't allow guest to block SIGSEGV

 linux-user/qemu.h    |   2 +
 linux-user/signal.c  | 118 ++++++++++++++++++++++++++++++++++++++++-----------
 linux-user/syscall.c |  14 +++---
 3 files changed, 103 insertions(+), 31 deletions(-)

-- 
1.9.0

             reply	other threads:[~2014-03-14 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 14:36 Peter Maydell [this message]
2014-03-14 14:36 ` [Qemu-devel] [PATCH 1/2] linux-user: Add wrapper for guest uses of sigprocmask function Peter Maydell
2014-03-14 14:36 ` [Qemu-devel] [PATCH 1/2] signal: added a wrapper for " Peter Maydell
2014-03-14 14:36 ` [Qemu-devel] [PATCH 2/2] linux-user: Don't allow guest to block SIGSEGV Peter Maydell

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=1394807816-14514-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=dann.frazier@canonical.com \
    --cc=matz@suse.de \
    --cc=patches@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).