public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb/gdb-7.12-branch] x32: gdb: Fix 'call' insn relocation with qRelocInsn
@ 2016-08-24  6:02 sergiodj+buildbot
  2016-08-24  5:42 ` Failures on Fedora-x86_64-native-gdbserver-m32, branch gdb-7.12-branch sergiodj+buildbot
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: sergiodj+buildbot @ 2016-08-24  6:02 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT c0c1412c584bc98d651354a029a50d054996bcef ***

Author: Pedro Alves <palves@redhat.com>
Branch: gdb-7.12-branch
Commit: c0c1412c584bc98d651354a029a50d054996bcef

x32: gdb: Fix 'call' insn relocation with qRelocInsn

Running the fast tracepoints tests against x32 gdbserver exposes a
latent bug.  E.g.,:

 (gdb)
 continue
 Continuing.
 Reading /media/sf_host-pedro/gdb/mygit/build-ubuntu-x32/gdb/testsuite/outputs/gdb.trace/change-loc/change-loc-2.sl from remote target...

 Thread 1 "change-loc" received signal SIGSEGV, Segmentation fault.
 func4 () at /home/pedro/gdb/src/gdb/testsuite/gdb.trace/change-loc.h:24
 24      }
 (gdb) FAIL: gdb.trace/change-loc.exp: 1 ftrace: continue to marker 2

The test sets a fast tracepoint on a shared library.  On x32, shared
libraries end up loaded somewhere in the upper 2GB of the 4GB address
space x32 has access to.  When gdbserver needs to copy an instruction
to execute it in the jump pad, it asks gdb to relocate/adjust it, with
the qRelocInsn packet.  gdb converts "call" instructions into a "push
$<2GB-4GB addr> + jmp" sequence, however, the "pushq" instruction sign
extends its operand, so later when the called function returns, it
returns to an incorrectly sign-extended address.  E.g.,
0xfffffffffabc0000 instead of 0xfabc0000, resulting in the
segmentation fault.

Fix this by converting calls at such addresses to "sub + mov + jmp"
sequences instead.

gdb/ChangeLog:
2016-08-23  Pedro Alves  <palves@redhat.com>

	* amd64-tdep.c (amd64_relocate_instruction) <callq>: Handle return
	addresses over 0x7fffffff.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-08-24 21:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24  6:02 [binutils-gdb/gdb-7.12-branch] x32: gdb: Fix 'call' insn relocation with qRelocInsn sergiodj+buildbot
2016-08-24  5:42 ` Failures on Fedora-x86_64-native-gdbserver-m32, branch gdb-7.12-branch sergiodj+buildbot
2016-08-24  6:18 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2016-08-24  8:21 ` Failures on Fedora-i686, " sergiodj+buildbot
2016-08-24 11:19 ` Failures on Debian-s390x-native-gdbserver-m64, " sergiodj+buildbot
2016-08-24 12:47 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2016-08-24 13:06 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2016-08-24 13:11 ` Failures on Fedora-s390x-m64, " sergiodj+buildbot
2016-08-24 14:53 ` Failures on Debian-i686, " sergiodj+buildbot
2016-08-24 15:26 ` Failures on Debian-i686-native-extended-gdbserver, " sergiodj+buildbot
2016-08-24 18:32 ` Failures on Fedora-ppc64be-native-gdbserver-m64, " sergiodj+buildbot
2016-08-24 18:57 ` Failures on Fedora-ppc64be-native-extended-gdbserver-m64, " sergiodj+buildbot
2016-08-24 19:39 ` Failures on Fedora-ppc64le-native-extended-gdbserver-m64, " sergiodj+buildbot
2016-08-24 23:09 ` Failures on Fedora-ppc64le-native-gdbserver-m64, " sergiodj+buildbot
2016-08-25  6:53 ` Failures on Debian-x86_64-m64, " sergiodj+buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).