From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-1825685-1518708344-2-12623690627105668176 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.001, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='org', MailFrom='org' X-Spam-charsets: plain='UTF-8' X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: stable-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1518708343; b=LMeOVcEJ3c4ykX4pcLEtnPUXPEA1Z+A17T+8fT7DPAWWUM1 hR+GBBZXEcW94Q1Qe5PZri9pJJJhbrIGAQYviezMvHnjcYMVvBKxUNEM7vXsrILL 43S2YYRuC7MBeK2ucaxg6QPk2PxeF5SFgz+v4QbiVX1/ioIT1ExHvm1euFAVY0Er BR0Y4OPGxIGTciSUYiuXcWVWPdoNo+AstHV4I0GapfpYf92+XsUIHTWUiS12gxln BpMm8J1C1bvcg8FBQOMZHKeFzWZOxKLJe9zvz4LB13PqxCTP9fPvHHefkzC8zSF1 gzczjh8x+av6Fc/Qf8Cj9eYwqyk0pNL+MfaMxHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender :list-id; s=arctest; t=1518708343; bh=ij2gdp3e6VAhQ/CZB6800qM+jK pbAT5QQIDZJaudsJs=; b=V8DFeI05GK61xyS2D3XqtVHGT8fZLTdq3B+j1LVRHY IvylKIOiH/+ApPUCZftH2ylB85nVjbGXDBxfugLOe9GdNvBCBEjZ1HuLfKTVE7yu Iw+JIbsB6+PC8ukKZhJugynqNqN2RaaaqBmVblpwROrlllw/muibJgJ16SKZD69w TXdr8ZouBGaxhZ1u0OFIBaYFuJqc8R4nQ1SOnmpXBuuV7LFYpsUzK/O5E4+comJT xJX6wSKGiblYYreKZFS/Wpz6XgYaWRhPEoAjvtiNoTYM2JdDvvUgE+MZYGU/OBzY +x7iNieZ2OX+q95+DRCCv1W7IfxklfX55PIHXn4Xet8Q== ARC-Authentication-Results: i=1; mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linuxfoundation.org; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=stable-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linuxfoundation.org header.result=pass header_is_org_domain=yes Authentication-Results: mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linuxfoundation.org; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=stable-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linuxfoundation.org header.result=pass header_is_org_domain=yes Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163211AbeBOPZk (ORCPT ); Thu, 15 Feb 2018 10:25:40 -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 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: stable-owner@vger.kernel.org X-Mailing-List: stable@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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);