[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/5] linux-user: Introduce host_signal_mask
|
From: |
Peter Maydell |
|
Subject: |
Re: [PATCH 2/5] linux-user: Introduce host_signal_mask |
|
Date: |
Tue, 8 Feb 2022 11:32:22 +0000 |
On Tue, 8 Feb 2022 at 11:17, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 2/8/22 21:59, Peter Maydell wrote:
> > On Tue, 8 Feb 2022 at 08:03, Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> Do not directly access the uc_sigmask member.
> >> This is preparation for a sparc64 fix.
> >>
> >> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> >> ---
> >> linux-user/include/host/aarch64/host-signal.h | 5 +++++
> >> linux-user/include/host/alpha/host-signal.h | 5 +++++
> >> linux-user/include/host/arm/host-signal.h | 5 +++++
> >> linux-user/include/host/i386/host-signal.h | 5 +++++
> >> .../include/host/loongarch64/host-signal.h | 5 +++++
> >> linux-user/include/host/mips/host-signal.h | 5 +++++
> >> linux-user/include/host/ppc/host-signal.h | 5 +++++
> >> linux-user/include/host/riscv/host-signal.h | 5 +++++
> >> linux-user/include/host/s390/host-signal.h | 5 +++++
> >> linux-user/include/host/sparc/host-signal.h | 5 +++++
> >> linux-user/include/host/x86_64/host-signal.h | 5 +++++
> >> linux-user/signal.c | 18 ++++++++----------
> >> 12 files changed, 63 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/linux-user/include/host/aarch64/host-signal.h
> >> b/linux-user/include/host/aarch64/host-signal.h
> >> index 9770b36dc1..76ab078069 100644
> >> --- a/linux-user/include/host/aarch64/host-signal.h
> >> +++ b/linux-user/include/host/aarch64/host-signal.h
> >> @@ -40,6 +40,11 @@ static inline void host_signal_set_pc(ucontext_t *uc,
> >> uintptr_t pc)
> >> uc->uc_mcontext.pc = pc;
> >> }
> >>
> >> +static inline void *host_signal_mask(ucontext_t *uc)
> >> +{
> >> + return &uc->uc_sigmask;
> >> +}
> >
> > Why void* rather than sigset_t* ?
>
> Because it's not really a sigset_t, even when it is in ucontext_t.
> It's a kernel_sigset_t, as per the comment in host_signal_handler.
I guess. handle_sigsegv_accerr_write()'s prototype just calls
it a sigset_t, though.
One approach would be to define a typedef for this kernel sigset_t,
and have wrappers for sigdelset() and sigprocmask() which take that
type rather than the libc sigset_t (plus a sigfillset that wrapped
the memset). Then we would avoid the potential bug that the
WARNING comment is talking about, because code wouldn't have
a thing that it could pass to sigfillset() without getting a
compiler complaint about the type. But maybe that's too heavyweight.
For the purposes of this series,
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
- [PATCH 0/5] linux-user: Fixes for sparc64 host, Richard Henderson, 2022/02/08
- [PATCH 1/5] common-user/host/sparc64: Fix safe_syscall_base, Richard Henderson, 2022/02/08
- [PATCH 3/5] linux-user: Introduce host_sigcontext, Richard Henderson, 2022/02/08
- [PATCH 4/5] linux-user: Move sparc/host-signal.h to sparc64/host-signal.h, Richard Henderson, 2022/02/08
- [PATCH 5/5] linux-user/include/host/sparc64: Fix host_sigcontext, Richard Henderson, 2022/02/08