From patchwork Mon Nov 20 21:21:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 119328 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4400673qgn; Mon, 20 Nov 2017 13:32:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMbfbKXKJAI8h3GlRHX8GL5sX+UfIXnU2jyDR8zuOkH4+wr7yJWrzxpiQ2TzA2AXuK/Nkurc X-Received: by 10.37.180.69 with SMTP id c5mr9723607ybg.193.1511213558312; Mon, 20 Nov 2017 13:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511213558; cv=none; d=google.com; s=arc-20160816; b=lpQCOoDtCrATV1INeYbOH0xkyF49W4+D3GGQ4WfQnviJEjlc05Svbvk8+4URuGCNJ2 Vx5aCOBy3bzQdhzA7xIdTV3RtkMkfSecSCYSv0LPnGU00JfmAbhatc8jTBQY6nll2W6m AtxsJcKAkyvMTp8q2WZnWepTcqU90bWfjahZ+hTTxiMxqyMDvksd5ni/auFgnJjd5FUi 1T2AJl0U8z7Ae5X7DuNxy+lxNHUvVvKz70b/n6LjAdb2gJZhwV+lzFYh1KAGkb1TBajO TOrEde9zbAaeENEAnEHk7v0KSXm8VVKB56fUhjwdDqnhjUu/MplIIeQ+jugp+fDmErrO rwfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=jpBWKIEaeGIsqdpEFfpflzsn3MKjwBVJ5ygjem87Imo=; b=0JCsuiV+qmpdRaZP7YMs77m6xMf595JRX/SKIuEfCE/PK8AfRoNMz0nJlV2NaBpkND l+/a4Muz8cUUui3/xwpyjdlbcivLjxUpBSr1PKXfDqhnvrMj19yfP/7qXAqwpmMl3dMY BnOa7HI47FxfxQcw53nYAYV5IWNDaB28Bj5AEeXHZQkI1qKDefW/OXy+yfGxDrgFZ0P5 dRWRrEl5wl185WpOAraDt5mtDHscfyp8gPokDZw1uuYPl9j+TEfXkiJrbsY9b0teK2Uv p4ctLeR7oy8/pm96IWPP3Ryxi1Qn25rQ+A3kjnitrrJqhprbmqcMZ/Z/d/kp+JvYT3cL AzGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cLwHPXu3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t9si2256223ybg.209.2017.11.20.13.32.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Nov 2017 13:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cLwHPXu3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtgD-0005BJ-T0 for patch@linaro.org; Mon, 20 Nov 2017 16:32:37 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jpBWKIEaeGIsqdpEFfpflzsn3MKjwBVJ5ygjem87Imo=; b=cLwHPXu3vckAVVL11Il6vTsI8bEr/O3dLSQWkGE/3UP5WxIfS9bT5u/Om4TnUVN4I6 pbCCXGlu+YJ953JHkKaatUOidLEX6F9jqIxUqAQ4CgGLuIPpUQzrQb20BMwL8FPfFEwB fxw/qyqj+AAz9IGHs4kGU4trl5jZ/cn0v4rIE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jpBWKIEaeGIsqdpEFfpflzsn3MKjwBVJ5ygjem87Imo=; b=hMY/OeTid2rZ1RhYEJ7dQrmOzDYz7CcAtriZTLYKHFcKUUDHRtUsn2cqiPSxqhH5qD iO3MbyhtUPQG9ht0TYJEQ4NmpLWfWxt6Jn7+DlyQW68zce6WH4xI4KBtOoVbqXdA0ly3 YXY+BTU4aBQhLZQU2mCbUUmnm+SjVIRJVA2ADj6D19VCHUJhOYaATX6XO+bA5A+nDhuT nUbpeM/eeHnqs3cdoTUkNZa8DpeMkagUji4KrCh+X0rj/T6b/Rd6GMxH9iZFm0a+lcpH fWnoXbLfEnGP1J9UPzeEwjM2cE2BPb8SmY8aUEnGfrTS4s4inf0jKbX56ajCZ41fMib0 4Hlw== X-Gm-Message-State: AJaThX4t3umJJ7TVd5jU1ecAPLwo7LmLlwsfM2xZXchc5ds6m4pTQECm 6+3WcZcqkcWS0U+zWOnmTGHlMLUg/b4= X-Received: by 10.25.40.5 with SMTP id o5mr3738564lfo.238.1511212921889; Mon, 20 Nov 2017 13:22:01 -0800 (PST) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id v63sm1645409lje.39.2017.11.20.13.22.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 13:22:00 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 20 Nov 2017 23:21:39 +0200 Message-Id: X-Mailer: git-send-email 2.14.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PULL 11/15] linux-user/s390x: Mask si_addr for SIGSEGV X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.14.2 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: