qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: shorne@gmail.com
Subject: Re: [Qemu-devel] [PATCH 1/2] linux-user: Implement signals for openrisc
Date: Fri, 1 Jun 2018 22:45:42 +0200	[thread overview]
Message-ID: <dbd7a0dd-a6db-e9ca-d9fd-7ae5e75efdb4@vivier.eu> (raw)
In-Reply-To: <20180531041822.5761-2-richard.henderson@linaro.org>

Le 31/05/2018 à 06:18, Richard Henderson a écrit :
> All of the existing code was boilerplate from elsewhere,
> and would crash the guest upon the first signal.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/openrisc/target_syscall.h |  23 +--
>  linux-user/openrisc/signal.c         | 210 +++++++++++----------------
>  linux-user/signal.c                  |   2 +-
>  target/openrisc/cpu.c                |   1 +
>  4 files changed, 87 insertions(+), 149 deletions(-)
> 
...
> @@ -148,11 +102,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
>                      target_siginfo_t *info,
>                      target_sigset_t *set, CPUOpenRISCState *env)
>  {
...
> @@ -160,47 +111,32 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
>          goto give_sigsegv;
>      }
>  
> -    info_addr = frame_addr + offsetof(struct target_rt_sigframe, info);
> -    __put_user(info_addr, &frame->pinfo);
> -    uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);
> -    __put_user(uc_addr, &frame->puc);
> +    tswap_siginfo(&frame->info, info);
>  
> -    if (ka->sa_flags & SA_SIGINFO) {
> -        tswap_siginfo(&frame->info, info);
> -    }

Why do you remove the "ka->sa_flags & SA_SIGINFO"?

> -    /*err |= __clear_user(&frame->uc, offsetof(ucontext_t, uc_mcontext));*/
>      __put_user(0, &frame->uc.tuc_flags);
>      __put_user(0, &frame->uc.tuc_link);
> +
>      target_save_altstack(&frame->uc.tuc_stack, env);
> -    setup_sigcontext(&frame->sc, env, set->sig[0]);
> +    setup_sigcontext(&frame->uc.tuc_mcontext, env);
>  
> -    /*err |= copy_to_user(frame->uc.tuc_sigmask, set, sizeof(*set));*/

other targets have something like:

    for (i = 0; i < TARGET_NSIG_WORDS; i++) {
        __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
    }

to match kernel

        err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));

Do we need it?

Thanks,
Laurent

  parent reply	other threads:[~2018-06-01 20:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  4:18 [Qemu-devel] [PATCH 0/2] linux-user openrisc fixes Richard Henderson
2018-05-31  4:18 ` [Qemu-devel] [PATCH 1/2] linux-user: Implement signals for openrisc Richard Henderson
2018-06-01 19:59   ` Laurent Vivier
2018-06-01 20:18     ` Richard Henderson
2018-06-01 20:45   ` Laurent Vivier [this message]
2018-06-01 21:15     ` Richard Henderson
2018-05-31  4:18 ` [Qemu-devel] [PATCH 2/2] linux-user: Fix struct sigaltstack " Richard Henderson
2018-05-31  8:20   ` Laurent Vivier

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=dbd7a0dd-a6db-e9ca-d9fd-7ae5e75efdb4@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shorne@gmail.com \
    /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).