From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [rfa/gdbserver] Fix ppc64 bi-arch TLS bug
Date: Wed, 28 May 2008 23:07:00 -0000 [thread overview]
Message-ID: <200805281829.m4SITpgT028177@d12av02.megacenter.de.ibm.com> (raw)
Hello,
this fixes another bug in ppc64 bi-arch gdbserver support: the
ppc_collect_ptrace_register did not zero out the register buffer
(in the case of a 4-byte inferior register on a 64-bit host).
This doesn't matter for the main user of this function
(usr_store_inferior_registers in linux-low.c) which always
zeros the buffer itself before passing it in.
However, there is a second caller, ps_lgetregs in proc-service.c
(via the ppc_fill_gregset function) which does *not* zero the
buffer. This could cause TLS access to fail in some instances
of 64->32 bit bi-arch debugging.
Fixed by simply always clearing the register buffer.
Tested on powerpc64-linux (-m64/-m32) and powerpc-linux using
local gdbserver.
OK for mainline?
Bye,
Ulrich
ChangeLog:
* linux-ppc-low.c (ppc_collect_ptrace_register): Clear buffer.
diff -urNp gdb-orig/gdb/gdbserver/linux-ppc-low.c gdb-head/gdb/gdbserver/linux-ppc-low.c
--- gdb-orig/gdb/gdbserver/linux-ppc-low.c 2008-05-11 23:03:06.000000000 +0200
+++ gdb-head/gdb/gdbserver/linux-ppc-low.c 2008-05-28 19:24:33.372182584 +0200
@@ -149,6 +149,9 @@ static void
ppc_collect_ptrace_register (int regno, char *buf)
{
int size = register_size (regno);
+
+ memset (buf, 0, sizeof (long));
+
if (size < sizeof (long))
collect_register (regno, buf + sizeof (long) - size);
else
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next reply other threads:[~2008-05-28 18:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-28 23:07 Ulrich Weigand [this message]
2008-05-29 0:18 ` Daniel Jacobowitz
2008-05-29 20:30 ` Ulrich Weigand
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=200805281829.m4SITpgT028177@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
/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