Received: by 10.223.185.116 with SMTP id b49csp6376866wrg; Wed, 28 Feb 2018 08:24:37 -0800 (PST) X-Google-Smtp-Source: AH8x227xFUCZIzJQm5Cj2pH3POK+eehqUr5eaxG2s8BUkH6Tcj3R8bq/HW84JMnr8jWu3CCsage+ X-Received: by 10.98.32.28 with SMTP id g28mr18369164pfg.182.1519835077137; Wed, 28 Feb 2018 08:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835077; cv=none; d=google.com; s=arc-20160816; b=sHK354GuA48uke695fBIwey7yn1U+IN04V3zag1hMfZEIFZO7WxyqkjGl4aAK+OqdJ xtupyqY6o7TrunhVAMEBiXSjMKDKXCDyjHpHNS01cJho8laxzgi5aKiJd6qcYnfgEHOU A4MHh1BlftAoxM/83qM6d93PUHnPOElStuUW7LHYM9nH6YDPMISnYhUIiOaFSh5YlETo ViMSnNcYH4CbUiSnRYx2iD1xb2LPWCdgf8JtaPUtMx7cs5YMHMh/RDu5t3iiaql0TI/+ kPzOPTfSREkW5WcQHf5hAUj6T+PNihQsyrQMgASUT4eeyu8qc6lgMAxrx+J3thU5OVDC 8vTQ== 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=SBnPYebmOX3U0XHgG4RnnwuMSVR8aCmSRQwHkh/JvP8=; b=xhhGa1xG+KaNeu1GcLxOMIvVBv/r9Pb2gMmOZA+D1MgQ+jMFcNS0qwVnaSdRVIt6Yf IqDCgCQr2IFQrXUkHlwmHDWQqjAkGR+0vucAxUT3SDBEm68O6GX229f+d46tBfxL5wuF vaTO6swLFhXvhyFeNZlnpsXqIk1edv7gl5Rxq2xBKDmHmNlZ220MBfoa7rssrk9GT/xD ZBsxubhaju/585PFSsvcnO3LFUSE9XKB/JUubTw0HidDImvFpBtqEZze8LO/gfbeP/k0 cUq17paf53BoyYs3fTcyHKciAMAWkgwcDFFYw2Wx9ygweuRy/e3anckP9rzv7IA4oc7v 0QbQ== 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 x205si1196482pgx.402.2018.02.28.08.24.22; Wed, 28 Feb 2018 08:24:37 -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 S935079AbeB1QXK (ORCPT + 99 others); Wed, 28 Feb 2018 11:23:10 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35393 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935188AbeB1QUv (ORCPT ); Wed, 28 Feb 2018 11:20:51 -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-0006XS-G5; Wed, 28 Feb 2018 15:22:30 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yg-00005N-Fl; 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, "Dave Martin" , "Linus Torvalds" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 106/254] mips/ptrace: Preserve previous registers for short regset write 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: Dave Martin commit d614fd58a2834cfe4efa472c33c8f3ce2338b09b upstream. Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET to fill all the registers, the thread's old registers are preserved. Signed-off-by: Dave Martin Signed-off-by: Linus Torvalds Signed-off-by: Ben Hutchings --- arch/mips/kernel/ptrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -484,7 +484,8 @@ static int fpr_set(struct task_struct *t &target->thread.fpu, 0, sizeof(elf_fpregset_t)); - for (i = 0; i < NUM_FPU_REGS; i++) { + BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t)); + for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) { err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &fpr_val, i * sizeof(elf_fpreg_t), (i + 1) * sizeof(elf_fpreg_t));