Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2215034imm; Mon, 28 May 2018 04:06:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrHy+QilKN7glxaMxzIuDl6Ih7CobG8B12epWVpWC5t6GDJXqQWo3r/DxeUK/6Jo0yaArWL X-Received: by 2002:a63:a60a:: with SMTP id t10-v6mr10165514pge.351.1527505583593; Mon, 28 May 2018 04:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527505583; cv=none; d=google.com; s=arc-20160816; b=estll8eYvWHZ2RwWH4Rg61Vl2x2WetGAkFc6JpGEvTvgJEGMQZbqJnMQ1wGJ0ONhSv RiwITyLHY34BkYofvyKf9eDW6CV1Mr0Vs7sU8EQaRRpi8CAMUUjeySruNH41lPNB8ou1 jCBtMVoTxm86YyK92eU4g0WMIhqkE57LgdtnjbDDesjpLd4YiZJfUGgcOuYMahpBDqu8 kZn0hDmYelR+8hdiBjns5S+CRhlksJOId4PKagGaeuqY3vuVNg54T5Z2DkGz4vsozc// t6eXFWEClBIXkbzRcEXtlwFmv5AHwDsXGQhYGJ5U7GmeOfvJDfzOxFaYX4o3D3bQfwAn f21Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=VuLGUtoE+ygG+/lYXLz/zPe+Vy58suWyhzs6TPtJhSg=; b=y1pxdiizilGNEsnNtizL02WRCjEjgqQ3RucsasDhGUqyRHink/lScjRZKR7mRNLfyR YkL18BddQqypF8pkx8DI+fwViZMmpsXo4xXGuWItnyTBWk9yLZR430+kS5/A8xkVgZ/3 d6h5Z1Z4AujR1EbTvwhfuHxTcLjLGihvKJCmFDwpPuYmS6SGwy6F4PpWxQN2SbhM48d1 APeHu0XGyB8azLNudj3TApCsNsCCpRRdUASG7e+7JR7lypr4JkxDI7gt7mlo5SAn2gZ6 Y/zoW4oY89su7gw+FvPyqnx5PmAysySm69IN8fDALnK9SqENt258EQP+A8rY1C2xAwcv gMjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ytpPVFWf; 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 a12-v6si30051707plp.225.2018.05.28.04.06.08; Mon, 28 May 2018 04:06:23 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ytpPVFWf; 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 S1165007AbeE1LEf (ORCPT + 99 others); Mon, 28 May 2018 07:04:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:51624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164596AbeE1LEa (ORCPT ); Mon, 28 May 2018 07:04:30 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D74520883; Mon, 28 May 2018 11:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505469; bh=cNeOcaFvFa69w5HMx57FUGDyishcCLqWgllT3WsqFlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytpPVFWfpE7WK0z4gdRsYnyCjCOzuGNo1AN3iLvZk8kyp5uXODYJ6h0QUoo1TviAd wYyCXV9Q2letLNM5ZEePBusGW0SIH97bdMcOdMpX7db2PAFwFAUIP9eshK53s/Tw7f EaMle8WEx85IdZh5mavfUkosYpcfGYcAtUB3KsTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Ralf Baechle , linux-mips@linux-mips.org, James Hogan Subject: [PATCH 4.16 006/272] MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs Date: Mon, 28 May 2018 12:00:39 +0200 Message-Id: <20180528100240.720957781@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maciej W. Rozycki commit 9a3a92ccfe3620743d4ae57c987dc8e9c5f88996 upstream. Check the TIF_32BIT_FPREGS task setting of the tracee rather than the tracer in determining the layout of floating-point general registers in the floating-point context, correcting access to odd-numbered registers for o32 tracees where the setting disagrees between the two processes. Fixes: 597ce1723e0f ("MIPS: Support for 64-bit FP with O32 binaries") Signed-off-by: Maciej W. Rozycki Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Cc: # 3.14+ Signed-off-by: James Hogan Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/ptrace.c | 4 ++-- arch/mips/kernel/ptrace32.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -807,7 +807,7 @@ long arch_ptrace(struct task_struct *chi fregs = get_fpu_regs(child); #ifdef CONFIG_32BIT - if (test_thread_flag(TIF_32BIT_FPREGS)) { + if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) { /* * The odd registers are actually the high * order bits of the values stored in the even @@ -902,7 +902,7 @@ long arch_ptrace(struct task_struct *chi init_fp_ctx(child); #ifdef CONFIG_32BIT - if (test_thread_flag(TIF_32BIT_FPREGS)) { + if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) { /* * The odd registers are actually the high * order bits of the values stored in the even --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c @@ -99,7 +99,7 @@ long compat_arch_ptrace(struct task_stru break; } fregs = get_fpu_regs(child); - if (test_thread_flag(TIF_32BIT_FPREGS)) { + if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) { /* * The odd registers are actually the high * order bits of the values stored in the even @@ -212,7 +212,7 @@ long compat_arch_ptrace(struct task_stru sizeof(child->thread.fpu)); child->thread.fpu.fcr31 = 0; } - if (test_thread_flag(TIF_32BIT_FPREGS)) { + if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) { /* * The odd registers are actually the high * order bits of the values stored in the even