From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtW0-0004kO-Er for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGtVz-0007yQ-Hb for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:04 -0500 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:42561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGtVz-0007xn-Af for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:03 -0500 Received: by mail-lf0-x241.google.com with SMTP id m1so11692656lfj.9 for ; Mon, 20 Nov 2017 13:22:03 -0800 (PST) From: riku.voipio@linaro.org Date: Mon, 20 Nov 2017 23:21:39 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 11/15] linux-user/s390x: Mask si_addr for SIGSEGV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell From: Peter Maydell 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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index aa02f25b85..b6dd9efd2d 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: -- 2.14.2