[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/59] linux-user/s390x: Fix sigframe types
From: |
Laurent Vivier |
Subject: |
[PULL 33/59] linux-user/s390x: Fix sigframe types |
Date: |
Mon, 17 May 2021 20:13:58 +0200 |
From: Richard Henderson <richard.henderson@linaro.org>
Noticed via gitlab clang-user job:
TEST signals on s390x
../linux-user/s390x/signal.c:258:9: runtime error: \
1.84467e+19 is outside the range of representable values of \
type 'unsigned long'
Which points to the fact that we were performing a double-to-uint64_t
conversion while storing the fp registers, instead of just copying
the data across.
Turns out there are several errors:
target_ulong is the size of the target register, whereas abi_ulong
is the target 'unsigned long' type. Not a big deal here, since we
only support 64-bit s390x, but not correct either.
In target_sigcontext and target ucontext, we used a host pointer
instead of a target pointer, aka abi_ulong.
Fixing this allows the removal of a cast to __put_user.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210428193408.233706-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/s390x/signal.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c
index b68b44ae7e99..707fb603d72e 100644
--- a/linux-user/s390x/signal.c
+++ b/linux-user/s390x/signal.c
@@ -37,13 +37,14 @@
typedef struct {
target_psw_t psw;
- target_ulong gprs[__NUM_GPRS];
- unsigned int acrs[__NUM_ACRS];
+ abi_ulong gprs[__NUM_GPRS];
+ abi_uint acrs[__NUM_ACRS];
} target_s390_regs_common;
typedef struct {
- unsigned int fpc;
- double fprs[__NUM_FPRS];
+ uint32_t fpc;
+ uint32_t pad;
+ uint64_t fprs[__NUM_FPRS];
} target_s390_fp_regs;
typedef struct {
@@ -51,22 +52,22 @@ typedef struct {
target_s390_fp_regs fpregs;
} target_sigregs;
-struct target_sigcontext {
- target_ulong oldmask[_SIGCONTEXT_NSIG_WORDS];
- target_sigregs *sregs;
-};
+typedef struct {
+ abi_ulong oldmask[_SIGCONTEXT_NSIG_WORDS];
+ abi_ulong sregs;
+} target_sigcontext;
typedef struct {
uint8_t callee_used_stack[__SIGNAL_FRAMESIZE];
- struct target_sigcontext sc;
+ target_sigcontext sc;
target_sigregs sregs;
int signo;
uint8_t retcode[S390_SYSCALL_SIZE];
} sigframe;
struct target_ucontext {
- target_ulong tuc_flags;
- struct target_ucontext *tuc_link;
+ abi_ulong tuc_flags;
+ abi_ulong tuc_link;
target_stack_t tuc_stack;
target_sigregs tuc_mcontext;
target_sigset_t tuc_sigmask; /* mask last for extensibility */
@@ -143,8 +144,7 @@ void setup_frame(int sig, struct target_sigaction *ka,
save_sigregs(env, &frame->sregs);
- __put_user((abi_ulong)(unsigned long)&frame->sregs,
- (abi_ulong *)&frame->sc.sregs);
+ __put_user((abi_ulong)(unsigned long)&frame->sregs, &frame->sc.sregs);
/* Set up to return from userspace. If provided, use a stub
already in userspace. */
--
2.31.1
- [PULL 29/59] linux-user/sparc: Add 64-bit support to fpu save/restore, (continued)
- [PULL 29/59] linux-user/sparc: Add 64-bit support to fpu save/restore, Laurent Vivier, 2021/05/17
- [PULL 18/59] linux-user/sparc: Merge sparc64/ into sparc/, Laurent Vivier, 2021/05/17
- [PULL 30/59] linux-user/sparc: Implement sparc32 rt signals, Laurent Vivier, 2021/05/17
- [PULL 32/59] tests/tcg/sparc64: Re-enable linux-test, Laurent Vivier, 2021/05/17
- [PULL 28/59] linux-user/sparc: Minor corrections to do_sigreturn, Laurent Vivier, 2021/05/17
- [PULL 36/59] linux-user/s390x: Remove restore_sigregs return value, Laurent Vivier, 2021/05/17
- [PULL 37/59] linux-user/s390x: Fix trace in restore_regs, Laurent Vivier, 2021/05/17
- [PULL 23/59] linux-user/sparc: Split out save_reg_win, Laurent Vivier, 2021/05/17
- [PULL 27/59] linux-user/sparc: Clean up setup_frame, Laurent Vivier, 2021/05/17
- [PULL 26/59] linux-user/sparc: Add rwin_save to signal frame, Laurent Vivier, 2021/05/17
- [PULL 33/59] linux-user/s390x: Fix sigframe types,
Laurent Vivier <=
- [PULL 34/59] linux-user/s390x: Use uint16_t for signal retcode, Laurent Vivier, 2021/05/17
- [PULL 45/59] linux-user/s390x: Add build asserts for sigset sizes, Laurent Vivier, 2021/05/17
- [PULL 24/59] linux-user/sparc: Clean up get_sigframe, Laurent Vivier, 2021/05/17
- [PULL 58/59] linux-user/elfload: fix filling psinfo->pr_psargs, Laurent Vivier, 2021/05/17
- [PULL 39/59] linux-user/s390x: Use tswap_sigset in setup_rt_frame, Laurent Vivier, 2021/05/17
- [PULL 31/59] linux-user/sparc: Implement sparc64 rt signals, Laurent Vivier, 2021/05/17
- [PULL 35/59] linux-user/s390x: Remove PSW_ADDR_AMODE, Laurent Vivier, 2021/05/17
- [PULL 40/59] linux-user/s390x: Tidy save_sigregs, Laurent Vivier, 2021/05/17
- [PULL 43/59] linux-user/s390x: Add stub sigframe argument for last_break, Laurent Vivier, 2021/05/17
- [PULL 46/59] linux-user/s390x: Clean up signal.c, Laurent Vivier, 2021/05/17