Received: by 10.223.185.116 with SMTP id b49csp237449wrg; Thu, 15 Feb 2018 20:49:24 -0800 (PST) X-Google-Smtp-Source: AH8x225xoESkLiK6WxO0pBIpsKNyY4X0QaJA5L9b6T/YQk/Zg1070OxCGYYgD+yOVj24Rau236q9 X-Received: by 10.101.73.12 with SMTP id p12mr4242053pgs.442.1518756564086; Thu, 15 Feb 2018 20:49:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518756564; cv=none; d=google.com; s=arc-20160816; b=BtUu9AFx9X4+W0TlYQ7iQaDJPw5v7treiEuXLD2tVxAaMfk6kKO3v+II/ocPc73H2J GFbTd2ztbkHBMYTNIp823Bl5Jsb2Chpie0qOJ43DbORae7Acn6jr44CVNNw7NhqD56r6 iuX1iBh3V3EXJsOJUF2012GGbk2P4CMj13gWV+6Im4CQsbmDi4aFl4ZMWQ30aFDEQJqU ENhMb8I8KFmU6QWIGsbHpsKJK74UC6DPL5JZj39XwdVDeJiEwbyIKDyvuMNBzd5ed4br eHr57GLw6lGnH4o9PYINwsCX5kwxyN95bdRNUs9Mwl6La2o/Jtvaar98ukKjEFCOxqGh TD0Q== 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=j7Y06fRxcXLhs6z53i2pkE16hoVPGWVXYf2xO4KZFEU=; b=y4DY5zYUVMALxn2ejv4xDsJijmJwRC5KmOuEVK6XXphIBgkqh3b9zMvvMYghYOMssV aHZIu5+/Dz04K1PTOB+FvaaPyD8zLa3jckhAbdOSktTO3lrv6qHJQk5FNPGF6qqx5uSp T/3cHmlm4A4GCt0KzxnkFzNETGewMxuSYPgDPzxLlTSmtnJgE44lGAwTvzKRIv5rXu7I 6+wDx7peRW3bBHHe27X2VL+Ae5dt6aYEsnvDR5+9Tvn8y6ThTuu5GECUWJOdVB8tEvXu o/AKjuDCNvrFbJSv07rga0SeVXvTg1sYtwYVrM+lPQsYMpz6nssD8cXC0AIq7pkaguLm 8JCg== 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 g7-v6si3431027plo.380.2018.02.15.20.49.08; Thu, 15 Feb 2018 20:49:24 -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 S1424914AbeBOPrb (ORCPT + 99 others); Thu, 15 Feb 2018 10:47:31 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36238 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424903AbeBOPr2 (ORCPT ); Thu, 15 Feb 2018 10:47:28 -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 E7235104D; Thu, 15 Feb 2018 15:47:27 +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 4.15 166/202] signal/openrisc: Fix do_unaligned_access to send the proper signal Date: Thu, 15 Feb 2018 16:17:46 +0100 Message-Id: <20180215151721.558986600@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@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 4.15-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 @@ -266,12 +266,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);