Return-Path: Received: from mail-bl2nam02on0135.outbound.protection.outlook.com ([104.47.38.135]:21497 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032136AbeCAP2y (ORCPT ); Thu, 1 Mar 2018 10:28:54 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: "Maciej W. Rozycki" , Ralf Baechle , Sasha Levin Subject: [added to the 4.1 stable tree] MIPS: Also verify sizeof `elf_fpreg_t' with PTRACE_SETREGSET Date: Thu, 1 Mar 2018 15:23:50 +0000 Message-ID: <20180301152116.1486-130-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: "Maciej W. Rozycki" 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 006501e039eec411842bb3150c41358867d320c2 ] Complement commit d614fd58a283 ("mips/ptrace: Preserve previous registers for short regset write") and like with the PTRACE_GETREGSET ptrace(2) request also apply a BUILD_BUG_ON check for the size of the `elf_fpreg_t' type in the PTRACE_SETREGSET request handler. Signed-off-by: Maciej W. Rozycki Fixes: d614fd58a283 ("mips/ptrace: Preserve previous registers for short re= gset write") Cc: James Hogan Cc: Paul Burton Cc: Alex Smith Cc: Dave Martin Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org # v4.11+ Patchwork: https://patchwork.linux-mips.org/patch/17929/ Signed-off-by: Ralf Baechle Signed-off-by: Sasha Levin --- arch/mips/kernel/ptrace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 57f217c90d72..9356f9d7bd0e 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -466,6 +466,7 @@ static int fpr_get_msa(struct task_struct *target, u64 fpr_val; int err; =20 + BUILD_BUG_ON(sizeof(fpr_val) !=3D sizeof(elf_fpreg_t)); for (i =3D 0; i < NUM_FPU_REGS; i++) { fpr_val =3D get_fpr64(&target->thread.fpu.fpr[i], 0); err =3D user_regset_copyout(pos, count, kbuf, ubuf, --=20 2.14.1