qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Laurent Vivier <laurent@vivier.eu>, 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 14:15:59 -0700	[thread overview]
Message-ID: <b24055e5-614f-a2bc-1326-476e1a4db777@linaro.org> (raw)
In-Reply-To: <dbd7a0dd-a6db-e9ca-d9fd-7ae5e75efdb4@vivier.eu>

On 06/01/2018 01:45 PM, Laurent Vivier wrote:
> 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"?

I thought it was unconditional for rt signals, which are the only ones that
openrisc has.  It's definitely odd, since the kernel also checks that flag, but
unconditionally points r4 to the (possibly uninitialized) siginfo_t.

>> -    /*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?

Yes, this is my mistake.


r~

  reply	other threads:[~2018-06-01 21:16 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
2018-06-01 21:15     ` Richard Henderson [this message]
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=b24055e5-614f-a2bc-1326-476e1a4db777@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.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).