Received: by 10.223.185.116 with SMTP id b49csp6362274wrg; Wed, 28 Feb 2018 08:10:58 -0800 (PST) X-Google-Smtp-Source: AG47ELvkADOiIZh7lok7ubShUmykZK+pntMIIW29n3PnTmU9A+JHdwP1aFlWHwCMTHCH1uipIJr9 X-Received: by 10.98.198.146 with SMTP id x18mr15055699pfk.22.1519834257946; Wed, 28 Feb 2018 08:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834257; cv=none; d=google.com; s=arc-20160816; b=w6OHmsraLyzG7RPSykb6j+Z99CzgLAOBCiB6AC09jygMa96iMOXrIlomM8OCWWhCvC WbfYS+qbo2bF44U4X67jh3sTs+cFC0iarmy+jhL/6gj36f3LIxdSwO8li1elyVH2qW9B rT+3AMLffLG1ExJpGB9S8pkEbMNBoPMB0EFA6pZ8byu5UmuWU+gHxSgf0p8jm2SVyKd9 ozClGJmH5SKmtaPyY8UgLPMBXPK19WGauPh1z1Abp/7zqpapTCqomPgIYF+eo37DnfJY YGEOCD0kjKOpm57PV8NN8joEMlQ75rOzIzzGzOStqnD+637k9ySliUWzwLD7QoOs/E0e 99Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=eoIX2rP7oMTDD+Mghhi/dr02dWB8QV5hz6t6R+RDLZo=; b=pdYRWeoy/GTJbyrffUJUMMy2FgSsMQGIhNSVMRciefadBzKxfQulAFj84lMa6npJ4m zfMZt2gvKgO09S5n9nG6Q5BBGUjpGlQgVS6lQsqhZ40s7AgXsmebUsijjMZeY0zPY2xE QKYNmZQU/2xRcvBXKyIZs97O0vQIxATBgRw1pwTCkdILwQ7vsS+K8sM3Qeq1XGPfPcQs HqlQ6YJYjCvpidUYBJyTA06i1fefMOv8bsLGw1fg4PWtITHxmWBQ1dJRRJ7Zj4kJn1yJ A+Ku7qfWrT5FLb5AzKBJHuhNZAUU3n86+HsBT0GciriSDGJwvb/ttCjVC6gKsdoYAiIo Cr2A== 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 j6-v6si1391544pll.799.2018.02.28.08.10.41; Wed, 28 Feb 2018 08:10:57 -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 S934480AbeB1QJ1 (ORCPT + 99 others); Wed, 28 Feb 2018 11:09:27 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34994 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934407AbeB1QJL (ORCPT ); Wed, 28 Feb 2018 11:09:11 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Ys-0006Xh-HK; Wed, 28 Feb 2018 15:22:30 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yg-00005h-Jg; Wed, 28 Feb 2018 15:22:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Paul Burton" , "Dave Martin" , "James Hogan" , "Ralf Baechle" , "Maciej W. Rozycki" , "Alex Smith" , linux-mips@linux-mips.org Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 110/254] MIPS: Disallow outsized PTRACE_SETREGSET NT_PRFPREG regset accesses In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Maciej W. Rozycki" commit c8c5a3a24d395b14447a9a89d61586a913840a3b upstream. Complement commit c23b3d1a5311 ("MIPS: ptrace: Change GP regset to use correct core dump register layout") and also reject outsized PTRACE_SETREGSET requests to the NT_PRFPREG regset, like with the NT_PRSTATUS regset. Signed-off-by: Maciej W. Rozycki Fixes: c23b3d1a5311 ("MIPS: ptrace: Change GP regset to use correct core dump register layout") Cc: James Hogan Cc: Paul Burton Cc: Alex Smith Cc: Dave Martin Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/17930/ Signed-off-by: Ralf Baechle Signed-off-by: Ben Hutchings --- arch/mips/kernel/ptrace.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -568,6 +568,9 @@ static int fpr_set(struct task_struct *t BUG_ON(count % sizeof(elf_fpreg_t)); + if (pos + count > sizeof(elf_fpregset_t)) + return -EIO; + init_fp_ctx(target); if (sizeof(target->thread.fpu.fpr[0]) == sizeof(elf_fpreg_t))