aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-06 18:33:23 +0000
committerRiku Voipio <riku.voipio@linaro.org>2017-11-07 21:58:13 +0200
commitf2d34df3c1a88a2cf86eb0afc88c369d799ae431 (patch)
tree6432ced47182f4566d6a6d01a9cbe247d6b867a9 /linux-user
parenta8b154a637b586441bad42259a8a9b9619cd117c (diff)
downloadqemu-f2d34df3c1a88a2cf86eb0afc88c369d799ae431.zip
qemu-f2d34df3c1a88a2cf86eb0afc88c369d799ae431.tar.gz
qemu-f2d34df3c1a88a2cf86eb0afc88c369d799ae431.tar.bz2
linux-user/s390x: Mask si_addr for SIGSEGV
For s390x, the address passed to a signal handler in the siginfo_t si_addr field is masked (in the kernel this is done in do_sigbus() and do_sigsegv() in arch/s390/mm/fault.c). Implement this architecture-specific oddity in linux-user. This is one of the issues described in https://bugs.launchpad.net/qemu/+bug/1705118 Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index aa02f25..b6dd9ef 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3238,6 +3238,10 @@ void cpu_loop(CPUAlphaState *env)
#endif /* TARGET_ALPHA */
#ifdef TARGET_S390X
+
+/* s390x masks the fault address it reports in si_addr for SIGSEGV and SIGBUS */
+#define S390X_FAIL_ADDR_MASK -4096LL
+
void cpu_loop(CPUS390XState *env)
{
CPUState *cs = CPU(s390_env_get_cpu(env));
@@ -3294,7 +3298,7 @@ void cpu_loop(CPUS390XState *env)
sig = TARGET_SIGSEGV;
/* XXX: check env->error_code */
n = TARGET_SEGV_MAPERR;
- addr = env->__excp_addr;
+ addr = env->__excp_addr & S390X_FAIL_ADDR_MASK;
goto do_signal;
case PGM_EXECUTE:
case PGM_SPECIFICATION: