From: Kees Cook <keescook@chromium.org>
To: gdb-patches@sourceware.org
Cc: Yao Qi <qiyaoltc@gmail.com>, Doug Evans <dje@google.com>,
brian.murray@canonical.com, matthias.klose@canonical.com
Subject: [PATCH v3] Fix PTRACE_GETREGSET failure for compat inferiors on arm64
Date: Thu, 19 Jan 2017 21:00:00 -0000 [thread overview]
Message-ID: <20170119210015.GA87383@beast> (raw)
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 <keescook@google.com>
* 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
next reply other threads:[~2017-01-19 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 21:00 Kees Cook [this message]
2017-01-26 19:43 ` Kees Cook
2017-01-26 23:23 ` Yao Qi
2017-01-26 23:37 ` Kees Cook
[not found] ` <20170127112807.GA24676@E107787-LIN>
2017-01-27 20:48 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170119210015.GA87383@beast \
--to=keescook@chromium.org \
--cc=brian.murray@canonical.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=matthias.klose@canonical.com \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox