Received: by 10.223.185.116 with SMTP id b49csp2395951wrg; Thu, 15 Feb 2018 10:58:58 -0800 (PST) X-Google-Smtp-Source: AH8x226R7S+rUDK3pfslauNkSHaZaNbA+SfV8QW0Ey4fhXmO/WaZccN4Or5bZ6QkxWO7ZmhrHFHH X-Received: by 10.101.81.141 with SMTP id h13mr2953171pgq.241.1518721137898; Thu, 15 Feb 2018 10:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518721137; cv=none; d=google.com; s=arc-20160816; b=pKMf/hAvTc7vz/CSpYdGvPMJxjierIGGBgvQk9LSHYJrwEPJ6M5SN99LUN7mlEkiDv mL+TFRMhYFLNMMorWP9JJxoFamztIJpzX9HEHjUp5RicEovHPCoFaJc0ppjX91BGUWwa W5EOMot17tmDaushTLrGxDcaBER4NhpyMjwZPQ7ysVinIaQFQQaq8PA5dvJQ7fhtsm7u 81JrhPnvD7byZ+jmGG2QUx++Fhrj5O7rg4jJBIHk/+zha4Oyvza0JjFwNeDhC8Fb0FeR WimhWGhkU6jbzz9+D6rkfdU0d4aMdZuiVmgxpXqwIWWtEC5jjr8aG9HnF8wH/YimpR8T ufvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hlt82rXkGXrpfSLO0nsObN6aK9B6HBXiKDrAmlVL2R0=; b=npggXWbU56dFPrv6wdxLzZvlKeyMIcFM/0sdjFJYNxdUN2OyV0fZcvU08NjV7uz7iy T3tMMdU0/1w4iR5gw0M86pkQ2Bv23wFqpCQV08/Y1Oug6WA08UqwYKEx7vKPTCCIOkxU wo5KxwDeUuBJOhXnDlwnL2Om5uYLgniLwvW3Pbfg/ANHav3KEYII4MsNQFUyPpGQ6MHQ 3muPdZ95r0gFM98WsV/73Ygj+0UEW4QWU1qbfb0TXNIXzQN2Q7Z5lMY5VL9/S+d9vqGf cAQmRyiF5q7wY/IF23ly2o+QtsDh3w2FO24acA6qOgjNNCI/7bNnxB8nyrZL0P8Pt7+V CA7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si2919699plo.820.2018.02.15.10.58.43; Thu, 15 Feb 2018 10:58:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1167023AbeBOS5r (ORCPT + 99 others); Thu, 15 Feb 2018 13:57:47 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48108 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161471AbeBOPTz (ORCPT ); Thu, 15 Feb 2018 10:19:55 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6EFDA1096; Thu, 15 Feb 2018 15:19:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonas Bonn , Stefan Kristiansson , Stafford Horne , Arnd Bergmann , openrisc@lists.librecores.org, "Eric W. Biederman" Subject: [PATCH 3.18 37/45] signal/openrisc: Fix do_unaligned_access to send the proper signal Date: Thu, 15 Feb 2018 16:17:28 +0100 Message-Id: <20180215144123.809884631@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215144115.863307741@linuxfoundation.org> References: <20180215144115.863307741@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric W. Biederman commit 500d58300571b6602341b041f97c082a461ef994 upstream. While reviewing the signal sending on openrisc the do_unaligned_access function stood out because it is obviously wrong. A comment about an si_code set above when actually si_code is never set. Leading to a random si_code being sent to userspace in the event of an unaligned access. Looking further SIGBUS BUS_ADRALN is the proper pair of signal and si_code to send for an unaligned access. That is what other architectures do and what is required by posix. Given that do_unaligned_access is broken in a way that no one can be relying on it on openrisc fix the code to just do the right thing. Fixes: 769a8a96229e ("OpenRISC: Traps") Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: Arnd Bergmann Cc: openrisc@lists.librecores.org Acked-by: Stafford Horne Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- arch/openrisc/kernel/traps.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -302,12 +302,12 @@ asmlinkage void do_unaligned_access(stru siginfo_t info; if (user_mode(regs)) { - /* Send a SIGSEGV */ - info.si_signo = SIGSEGV; + /* Send a SIGBUS */ + info.si_signo = SIGBUS; info.si_errno = 0; - /* info.si_code has been set above */ - info.si_addr = (void *)address; - force_sig_info(SIGSEGV, &info, current); + info.si_code = BUS_ADRALN; + info.si_addr = (void __user *)address; + force_sig_info(SIGBUS, &info, current); } else { printk("KERNEL: Unaligned Access 0x%.8lx\n", address); show_registers(regs);