From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam03on0090.outbound.protection.outlook.com ([104.47.42.90]:61856 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032443AbeCAPfI (ORCPT ); Thu, 1 Mar 2018 10:35:08 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: "Eric W. Biederman" , Sasha Levin Subject: [added to the 4.1 stable tree] mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy Date: Thu, 1 Mar 2018 15:26:21 +0000 Message-ID: <20180301152116.1486-357-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: "Eric W. Biederman" This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 6ac1dc736b323011a55ecd1fc5897c24c4f77cbd ] Setting si_code to 0 is the same a setting si_code to SI_USER which is defi= nitely not correct. With si_code set to SI_USER si_pid and si_uid will be copied = to userspace instead of si_addr. Which is very wrong. So fix this by using a sensible si_code (SEGV_MAPERR) for this failure. Cc: stable@vger.kernel.org Fixes: b920de1b77b7 ("mn10300: add the MN10300/AM33 architecture to the ker= nel") Cc: David Howells Cc: Masakazu Urade Cc: Koichi Yasutake Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- arch/mn10300/mm/misalignment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.= c index b9920b1edd5a..70cef54dc40f 100644 --- a/arch/mn10300/mm/misalignment.c +++ b/arch/mn10300/mm/misalignment.c @@ -437,7 +437,7 @@ asmlinkage void misalignment(struct pt_regs *regs, enum= exception_code code) =20 info.si_signo =3D SIGSEGV; info.si_errno =3D 0; - info.si_code =3D 0; + info.si_code =3D SEGV_MAPERR; info.si_addr =3D (void *) regs->pc; force_sig_info(SIGSEGV, &info, current); return; --=20 2.14.1