From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126604 invoked by alias); 26 Jan 2017 19:43:30 -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 125938 invoked by uid 89); 26 Jan 2017 19:43:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=noticeably, vfp, UD:core, Cook X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Jan 2017 19:43:19 +0000 Received: by mail-it0-f41.google.com with SMTP id c7so41032548itd.1 for ; Thu, 26 Jan 2017 11:43: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:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9RR9ZyQXeBczGYJ8ZdToXrFwIVhIih3nktweD4PqclQ=; b=MDJjqZtNbZqw7ErZ7r8z4aL197p9hw5DHyT/dadaul8tw5Fs9M6NPu6uYXaNLyQG1d lk+48KmEVnSZXLRrsy+j9E2l4TQO6xdVenLQCHwZDY73ytiLD5MAlChsr2v6zuJI/egM aT3W72rTo5CcVG5YQ46BH0V+Gg1KGU//i2NNoywHnuv3mWySgDwT0qB0hXB3fhlzcPOA Wud8xcVxDK/I2QvdIQBYZJG9mKFwPbaZXnM2CLFKo/8VuxY9ohBdOiVqhLZo83wtjzV7 4hcCJNqyFXoloyjkbkTQwT8ViSieY7JXQofTXArKM3mUS7R4FaE2EmbFX9UxAQ+lU87f yyXQ== X-Gm-Message-State: AIkVDXLIiviVQH2bgPMWR6Ja1zYp/WwtNTyFH5JXvF5ltuzZTv0QiOo8kN6o2dcFTDsUqFvtufW1AmhpeRTaw/c3 X-Received: by 10.36.254.66 with SMTP id w63mr143728ith.28.1485459797448; Thu, 26 Jan 2017 11:43:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.143.138 with HTTP; Thu, 26 Jan 2017 11:43:16 -0800 (PST) In-Reply-To: <20170119210015.GA87383@beast> References: <20170119210015.GA87383@beast> From: Kees Cook Date: Thu, 26 Jan 2017 19:43:00 -0000 Message-ID: Subject: Re: [PATCH v3] Fix PTRACE_GETREGSET failure for compat inferiors on arm64 To: gdb-patches@sourceware.org Cc: Yao Qi , Doug Evans , Brian Murray , Matthias Klose Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2017-01/txt/msg00603.txt.bz2 On Thu, Jan 19, 2017 at 1:00 PM, Kees Cook wrote: > 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. Hi! Friendly ping on this patch. Are there any corrections to be made, or can someone commit it? Thanks! -Kees > --- > 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 -- Kees Cook Nexus Security