Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2154794imm; Wed, 16 May 2018 08:41:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoj3wMRL8wUzTtHBPgJ0D/CdfoN90fqoKwr3SJ1q0HsTrQ2w8cOKQJYL9WoXKVWFYIHzr9t X-Received: by 2002:a17:902:6006:: with SMTP id r6-v6mr1429634plj.70.1526485268217; Wed, 16 May 2018 08:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526485268; cv=none; d=google.com; s=arc-20160816; b=zJuDRREu0GWVJW3C8UP/vO7jGBwVs9TeFXMmPsVPiKFnUgNSg9vVuSCvlSCnuIlYYd YAEH+eI1/gqUIpowP7M81MagO/g3Pp+pvXf1V+elkY7eWrEVJwNb+045eLFdX7JLQrtF MfVmrNhhDjmZC8lkesCCDBO30gXj1LHEggb2zwHhK6R9CrZPv2Uf7CQ5ch11QDsxtkC2 yVMyRk9mLyCqhn07yOwxThTvFjRAeLB9ZCJbO4mV2PTG3juLFTgVSHbCRwB+7s5gDgT3 C3MRNWUYUBEzeBj+gPBcfHO+vcb3LRv28UURjL0NYt9lbrrm3d+VPTG2eoT3TCKAavvP vF8g== 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:message-id :subject:cc:to:from:date:arc-authentication-results; bh=q/mgq8o8e+LYCa7DTifz/zeg+zshgIDqfaLQymDt+Rs=; b=BKmXhc9OrQP5tNxQCjz1DGxbh43tVfb4XrBdcMR02Dn7hDdwkG2pSl0kPS1o3dmtU0 OWeLLdDY13HI+nf+30kKbQkDC0OInKGSX8nKWMCYrHOjJVhUy8f2OfxKDorTZD2tZSJn VLD+sUIPYoMd/f6PxvObiigoS4eyun/OgsMaXw0p0Nf383w5kCSFqpPf6t0ePz0V2GAg 4VTu5R6RN6Q8W9deDRUWDjBpxULs+lt1aW2wHFpcrz5zJmb5CfHURPhnNw+eQnb7boy3 IjXrXq+6Lwo5WFP7pnj2FiOKCsedeoPGtb2y9mz+Dy3lnGvJOgrB1mNCEUOi6hML90d8 JgeA== 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 v29-v6si2879822pfk.116.2018.05.16.08.40.54; Wed, 16 May 2018 08:41:08 -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; 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 S1751028AbeEPPkm (ORCPT + 99 others); Wed, 16 May 2018 11:40:42 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:39203 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746AbeEPPkk (ORCPT ); Wed, 16 May 2018 11:40:40 -0400 Received: from mipsdag02.mipstec.com (mail2.mips.com [12.201.5.32]) by mx28.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Wed, 16 May 2018 15:40:08 +0000 Received: from [10.20.78.133] (10.20.78.133) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Wed, 16 May 2018 08:40:35 -0700 Date: Wed, 16 May 2018 16:39:58 +0100 From: "Maciej W. Rozycki" To: James Hogan CC: Ralf Baechle , , , Subject: [PATCH] MIPS: ptrace: Fix PTRACE_PEEKUSR requests for 64-bit FGRs Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.20.78.133] X-ClientProxiedBy: mipsdag02.mipstec.com (10.20.40.47) To mipsdag02.mipstec.com (10.20.40.47) X-BESS-ID: 1526485207-637138-23749-67371-1 X-BESS-VER: 2018.6-r1805102334 X-BESS-Apparent-Source-IP: 12.201.5.32 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.193036 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use 64-bit accesses for 64-bit floating-point general registers with PTRACE_PEEKUSR, removing the truncation of their upper halves in the FR=1 mode, caused by commit bbd426f542cb ("MIPS: Simplify FP context access"), which inadvertently switched them to using 32-bit accesses. The PTRACE_POKEUSR side is fine as it's never been broken and continues using 64-bit accesses. Cc: # 3.19+ Fixes: bbd426f542cb ("MIPS: Simplify FP context access") Signed-off-by: Maciej W. Rozycki --- Hi, Here's another one, spotted in the course of GDB PR gdb/22286 regression testing with the n64 ABI. Please apply. Maciej --- arch/mips/kernel/ptrace.c | 2 +- arch/mips/kernel/ptrace32.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) linux-mips-ptrace-peekusr-fp64.diff Index: linux/arch/mips/kernel/ptrace.c =================================================================== --- linux.orig/arch/mips/kernel/ptrace.c 2018-05-15 17:44:25.000000000 +0100 +++ linux/arch/mips/kernel/ptrace.c 2018-05-16 11:22:00.714605000 +0100 @@ -1070,7 +1070,7 @@ long arch_ptrace(struct task_struct *chi break; } #endif - tmp = get_fpr32(&fregs[addr - FPR_BASE], 0); + tmp = get_fpr64(&fregs[addr - FPR_BASE], 0); break; case PC: tmp = regs->cp0_epc; Index: linux/arch/mips/kernel/ptrace32.c =================================================================== --- linux.orig/arch/mips/kernel/ptrace32.c 2018-05-15 17:45:16.000000000 +0100 +++ linux/arch/mips/kernel/ptrace32.c 2018-05-16 11:22:16.313698000 +0100 @@ -109,7 +109,7 @@ long compat_arch_ptrace(struct task_stru addr & 1); break; } - tmp = get_fpr32(&fregs[addr - FPR_BASE], 0); + tmp = get_fpr64(&fregs[addr - FPR_BASE], 0); break; case PC: tmp = regs->cp0_epc;