Received: by 10.223.185.116 with SMTP id b49csp458747wrg; Fri, 16 Feb 2018 01:46:28 -0800 (PST) X-Google-Smtp-Source: AH8x226HJ/EVJC0njTpLHrykgSi4I2dK4Q9gAdr1V6me+NJL5pp4me77jH7+sVQsOo/fGXnhRmdM X-Received: by 2002:a17:902:d203:: with SMTP id t3-v6mr5338759ply.70.1518774387904; Fri, 16 Feb 2018 01:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518774387; cv=none; d=google.com; s=arc-20160816; b=L7KJqPqp3KqbWvbTF327L9/b1Fc2d8D1VDSBLSNNH/219R7eHmN6ZzksFDw0ewG2Wy REx/QtdbPIJL6EI10x8ii58ciX8RQ/zSM1IF0O6GekSOA0AMenpE4fTfyNuMXh0x0XpA xf/6AcjRVa4x364NCmnJ+Nh6q9EwbwXSwaXVdVlHK+383/EGHKmCo85+reNcQrKaN8Gu 33RZhTc7+PPFo0SJ3g8ELFDfh8RbdTs6/3Cvoo5NfRYojQGSwkKpp0v2a3zcmKNq6bLr RKTbQKlmdvwxiUt9yI+op2sG8WTYeu2Feq7VNtjdRSLzFt9/Gor7AlSXBA5OSGkjxZGv +Z0w== 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=5xEbT0uWLLjnjVaeIfjrX5YBWs/yMq3wfO8mrwS7CpQ=; b=K/NofG2IVPv0XIrwLeW4O4o8nuuVRHldVfgQSXW73f0GSSsLZ1+f6Aso3RcED+pgTU da3CC3W3FLZRWSrjoyOy692WVYPE4/fhCNaaj+L+VeuanRexblkMwH2cn7K8KFRMtjkF GNmWJiUu6QinmnZSPdGWF+r0Hw/l/h5D1IYKVg8VjLT8/zMNhLPwohrtGLMuU3BUet4Q yTd21nNyMm5iD3U2PRPSWSqL0cmeY0NZ3fp9P/tzhfZ4hmPge+3rPAQ9zPeCwsJpafra CkLokBCRlzxPXV43MeVIZVF2JiwwfxR9cRMVKEm3PfrbHovT4UrnwfhVEyCZMmHHl9GK HAXA== 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 a64si1847417pfb.405.2018.02.16.01.46.13; Fri, 16 Feb 2018 01:46:27 -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 S1426915AbeBORE2 (ORCPT + 99 others); Thu, 15 Feb 2018 12:04:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59482 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423337AbeBOPie (ORCPT ); Thu, 15 Feb 2018 10:38: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 E959A10F0; Thu, 15 Feb 2018 15:38: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.14 162/195] signal/openrisc: Fix do_unaligned_access to send the proper signal Date: Thu, 15 Feb 2018 16:17:33 +0100 Message-Id: <20180215151714.057556782@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-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 @@ -306,12 +306,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);