Received: by 10.223.185.116 with SMTP id b49csp2557075wrg; Thu, 15 Feb 2018 13:35:40 -0800 (PST) X-Google-Smtp-Source: AH8x227ZrkD+vTw9N6esgeCLgbmDYyFVF7yqEK/quo5d758eP0LgltyoHBGhhwzU2MKV+L4x2Sd2 X-Received: by 10.98.172.21 with SMTP id v21mr3981252pfe.66.1518730540751; Thu, 15 Feb 2018 13:35:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518730540; cv=none; d=google.com; s=arc-20160816; b=oL18TbX1dpVa99PChF0IakwmxsHjdglh8vCVG2m+qQbXsBHbKmPWoK1SwPsxoqDWy1 EdyjCss+bpejY2PMrXPA7PzkkBAmJvhslnmGyzf1eSFqyOnuLII36kAyg+KE2wI8vyHU RuZbMtrh7cA4jjMroF3YONwEKLCpHZinT0ZO9skRDrtrEVZt7+LvERnkowScmysrs2Mn v3Vv8S3vRL85sl4j4Ox5k3w9ZTxO9iv1aH7J/ZDYZN03Au8Oy2GBL5CpgS50q8dtOoNa N9uUR5fKuw1KMQavpu91dNj3rNzIKSA75yRCi4D9OiJe72AFBeV794h1w0lNd418ADjN UTUQ== 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=LFOH/VUvHq3hG/RXTyX7nbCepzWn6NUTAv0hNbBW568=; b=l/9EUMCfp/VypqjsiLFKthZuRjeJooKd07JY8BLQHEcT9pZ4pWmdnHC0T4zbdhbRzu Q47TCe3x3Ce+gFeeJkYP2BDd1AxPX0F4PfRXEX5yAmQgaGhnSLiUHNBw+3H9dOeL7gAG DFiCM30n63rVUBEleN+qh0NLQpCeG6r69QSH+2XoXcctOWwC82uS4Amo0L6OjMKFvkW9 1RL439YLkzqFibuTR1Si6vMQh2ESzqJjXpAeRoweEK5O8DJRePotJa/rl1N4eFbq49cY r/xAJQXrjur1ktd6yaGZmLO8tS0Di4bvlvNPxlN832tc/4HbXkV2yKlXvKiLur0e31Oq qzew== 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 r62si4581146pgr.77.2018.02.15.13.35.25; Thu, 15 Feb 2018 13:35:40 -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 S1163828AbeBOP2e (ORCPT + 99 others); Thu, 15 Feb 2018 10:28:34 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53866 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163783AbeBOP2c (ORCPT ); Thu, 15 Feb 2018 10:28:32 -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 CFBC7105C; Thu, 15 Feb 2018 15:28:31 +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.9 70/88] signal/openrisc: Fix do_unaligned_access to send the proper signal Date: Thu, 15 Feb 2018 16:17:37 +0100 Message-Id: <20180215151232.219981528@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@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.9-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);