From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112121 invoked by alias); 19 Jan 2017 21:00:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111819 invoked by uid 89); 19 Jan 2017 21:00:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Cook, noticeably, needless, sk:arm_lin X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Jan 2017 21:00:18 +0000 Received: by mail-pf0-f172.google.com with SMTP id y143so16238602pfb.0 for ; Thu, 19 Jan 2017 13:00:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=L0YDo5NMBGGWJHlXIR6x+QYVByvR0AoeBCPGnviDX1U=; b=MntDB5dSZSxkHQQhs/Hazl/ucSoLb5Hx0gXQ0uITPTHlKjI5behCKtonRjzvdjJJLU Qe7yOm+ucdp3Ynjg68EQe7PxldsdqNG+bdGy7Iiv024uChEDImODFMIjxd5bF6+6yxep 8HYo9S+AhJbTtqCxWVa2f1uwIzmr0VNCwO6qUuoyq/APWwVm9avzaHxp8tVzSFzrmZ/g vwVm1CccLmccBQE76SxVJEMJ7al2XDSseBK4ez08s6FdedlBA8E1rNyL9k1qqTTqmpbZ vVyzpnIst+SbONEw94cTVM36dvMzkCo5E/C7fhrpxOmVikUZTLR4y4cSnL9ObgvJpXFU C3Ng== X-Gm-Message-State: AIkVDXJvSfWJZekgPYrIZPq3fxq+Hy1GRbwS7fCOCWIcqxTG79TGffrrUNbyHpkUafArYS5b X-Received: by 10.99.184.18 with SMTP id p18mr12831407pge.33.1484859616738; Thu, 19 Jan 2017 13:00:16 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id y201sm11044940pfb.16.2017.01.19.13.00.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 13:00:16 -0800 (PST) Date: Thu, 19 Jan 2017 21:00:00 -0000 From: Kees Cook To: gdb-patches@sourceware.org Cc: Yao Qi , Doug Evans , brian.murray@canonical.com, matthias.klose@canonical.com Subject: [PATCH v3] Fix PTRACE_GETREGSET failure for compat inferiors on arm64 Message-ID: <20170119210015.GA87383@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-SW-Source: 2017-01/txt/msg00397.txt.bz2 When running a 32-bit ARM inferior with a 32-bit ARM GDB on a 64-bit AArch64 host, only VFP registers (NT_ARM_VFP) are available. The FPA registers (NT_PRFPREG) are not available so GDB must not request them, as this will fail with -EINVAL. This is most noticeably exposed when running "generate-core-file": (gdb) generate-core-file myprog.core Unable to fetch the floating point registers.: Invalid argument. ptrace(PTRACE_GETREGSET, 27642, NT_FPREGSET, 0xffcc67f0) = -1 EINVAL (Invalid argument) gdb/ChangeLog: 2016-12-19 Kees Cook * gdb/arm-linux-nat.c: Skip soft-float registers when using hard-float. --- v3: - argh, actually drop needless other change. v2: - check have_fpa_registers instead, dropped needless other change: qiyaoltc --- gdb/arm-linux-nat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index d11bdc6..4fa5204 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -384,13 +384,14 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, if (-1 == regno) { fetch_regs (regcache); - fetch_fpregs (regcache); if (tdep->have_wmmx_registers) fetch_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) fetch_vfp_regs (regcache); + if (tdep->have_fpa_registers) + fetch_fpregs (regcache); } - else + else { if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM) fetch_regs (regcache); @@ -420,11 +421,12 @@ arm_linux_store_inferior_registers (struct target_ops *ops, if (-1 == regno) { store_regs (regcache); - store_fpregs (regcache); if (tdep->have_wmmx_registers) store_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) store_vfp_regs (regcache); + if (tdep->have_fpa_registers) + store_fpregs (regcache); } else { -- 2.7.4 -- Kees Cook Nexus Security