Received: by 10.223.185.116 with SMTP id b49csp2160925wrg; Thu, 15 Feb 2018 07:27:12 -0800 (PST) X-Google-Smtp-Source: AH8x224VqBpcOCc8ABC5IkAyzV3qmVMVmYTgg0q9atjnHKHoG9Qtd870VZuXGwHYPtQDcTwWqp+i X-Received: by 10.101.98.85 with SMTP id q21mr2461363pgv.182.1518708432498; Thu, 15 Feb 2018 07:27:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518708432; cv=none; d=google.com; s=arc-20160816; b=k/Ezoedi7KSl4yb6Sj0LldpYp+dr9nw4mOCpAT1ebhX8RKOLy5LaE4A63odou+gJn7 IhUk0g+sxUYYncW0hA+WEo5Zrz47hxb0h8Au6EEQsZXL99fb4opyrG68Y6qt7MRyKcrp YU1vKXWHVXBXj2x5OpbLqvdPM1usDSgxgV4C7a5SFHESY0z2yvzVEb+VdGweIfKWrcHV MjUVO6JIW+L7CFv8gF4pTQiDnhJ3BZbZKHyGKbS4XAJsryl7jWqS/OxbPGZu9pmmjV3j WdmQo6VRzfL2COsC4Mrc+f1ORdpAqRMv+U4nJ+iB3P1GwAdKJP3ECw2HQCG+u/CmP8kf HC9g== 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=ij2gdp3e6VAhQ/CZB6800qM+jKpbAT5QQIDZJaudsJs=; b=DD7iYiFDXgwWlW8nXuUF29bBTRG9Xp66MnIcRiIClHmJaN8DIYkNVrJJABEaF1O5z9 v3cxpfTt/fC9DJr5R51szyDkbxEZN2MirvnGk/HSwr6iG14Mpp9owF9uv5jMTB4ajArz n3lTSfPyOpRdZi60QlBgnzoKVsfsvzX3wvKgCjwPx2p+LR6WGxlWMlx2jAAnb+53kzEN fR+zvALmYPF0fpDc4BaeyqXeIRXYkEHwKuUnQTQa3qTD/x5lvM+v007nsI3fh9MS22BY 9FUlsfP0QRaH1nSDzsbAlbQ7ne+zcnQ6kjWhu5SsCmhH/PXUahzBmAxo5A9fMY8GZ7y0 Yd1g== 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 2si7557pfd.275.2018.02.15.07.26.58; Thu, 15 Feb 2018 07:27:12 -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 S1163235AbeBOPZp (ORCPT + 99 others); Thu, 15 Feb 2018 10:25:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:52282 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163203AbeBOPZe (ORCPT ); Thu, 15 Feb 2018 10:25:34 -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 71F7E1118; Thu, 15 Feb 2018 15:25:33 +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.4 096/108] signal/openrisc: Fix do_unaligned_access to send the proper signal Date: Thu, 15 Feb 2018 16:17:33 +0100 Message-Id: <20180215151235.732345205@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@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.4-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);