All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Alex Barcelo <abarcelo@ac.upc.edu>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] signal: sigsegv protection on do_sigprocmask
Date: Wed, 10 Oct 2012 16:54:58 +0100	[thread overview]
Message-ID: <CAFEAcA-jke2+qgRhaTSK9AGM8XLynhjr6ngpf=7RTtHUkj95gA@mail.gmail.com> (raw)
In-Reply-To: <1348935086-11336-3-git-send-email-abarcelo@ac.upc.edu>

On 29 September 2012 17:11, Alex Barcelo <abarcelo@ac.upc.edu> wrote:

> Re: [Qemu-devel] [PATCH 2/2] signal: sigsegv protection on do_sigprocmask

The convention for the initial summary line of a patch is that
it starts with an indication of the subsystem being patched. For
instance, here it might be:

"linux-user: Don't allow guest to block SIGSEGV"

> The sigsegv protection is done by forcing the catch (needed in qemu-user)
> and then taking it off from the return mask (well, adding it in fact)

I'm afraid I couldn't really understand what you're trying to
say in this commit message. Perhaps you could expand it a bit?

(missing Signed-off-by:.)
>
> ---
>  linux-user/signal.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index b8b8268..8764f57 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -5468,7 +5468,14 @@ long do_rt_sigreturn(CPUArchState *env)
>   */
>  int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
>  {
> -    return sigprocmask(how, set, oldset);
> +    int ret;
> +    sigset_t temp = *set;

This is dereferencing set, which will crash if it is NULL.

> +    if (set) {
> +        sigdelset(&temp, SIGSEGV);
> +    }
> +    ret = sigprocmask(how, &temp, oldset);

You need to pass NULL in here rather than &temp if the 'set'
argument was NULL.

> +    sigaddset(oldset, SIGSEGV);
> +    return ret;
>  }

So, we don't permit the guest to block SIGSEGV; that makes sense.
Does it make sense to always tell the guest SIGSEGV is blocked?
(what this patch currently does).
The other options would be "tell the guest SIGSEGV is never blocked"
and "actually maintain somewhere the state of whether the guest
thinks SIGSEGV is blocked so we can return the right answer".

I'm just wondering which would be generally better for guests
and why you picked this approach rather than one of the other
options. (it might be the best, I haven't thought too hard
about it...)

thanks
-- PMM

  reply	other threads:[~2012-10-10 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29 16:11 [Qemu-devel] [PATCH 0/2] signal: Preparing safe sigprocmask wrapper on qemu-user Alex Barcelo
2012-09-29 16:11 ` [Qemu-devel] [PATCH 1/2] signal: added a wrapper for sigprocmask function Alex Barcelo
2012-10-10 15:48   ` Peter Maydell
2012-09-29 16:11 ` [Qemu-devel] [PATCH 2/2] signal: sigsegv protection on do_sigprocmask Alex Barcelo
2012-10-10 15:54   ` Peter Maydell [this message]
2012-10-08 18:42 ` [Qemu-devel] [PATCH 0/2] signal: Preparing safe sigprocmask wrapper on qemu-user Alex Barcelo
2012-10-10 15:37   ` Peter Maydell
2012-10-17 14:22     ` Alex Barcelo

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='CAFEAcA-jke2+qgRhaTSK9AGM8XLynhjr6ngpf=7RTtHUkj95gA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=abarcelo@ac.upc.edu \
    --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 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.