diff options
author | George Barrett <bob@bob131.so> | 2020-01-11 06:30:28 +1100 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-01-10 14:58:37 -0500 |
commit | 7f0ae84c80aae6fe8f7573343fe1ab455d18b5d8 (patch) | |
tree | 16de1a790fb014f27a7c09d634df9f5215961da3 /libiberty/regex.c | |
parent | 47e9d49d2d795224f4b3f04c89c268627b850be4 (diff) | |
download | gdb-7f0ae84c80aae6fe8f7573343fe1ab455d18b5d8.zip gdb-7f0ae84c80aae6fe8f7573343fe1ab455d18b5d8.tar.gz gdb-7f0ae84c80aae6fe8f7573343fe1ab455d18b5d8.tar.bz2 |
Fix handling of null stap semaphores
According to the SystemTap documentation on user-space probes[0], stap
probe points without semaphores are denoted by setting the semaphore
address in the probe's note to zero. At present the code does do a
comparison of the semaphore address against zero, but only after it's
been relocated; as such it will (almost?) always fail, commonly
resulting in GDB trying to overwrite the ELF magic located at the
image's base address.
This commit tests the address as specified in the SDT note rather than
the relocated value in order to correctly detect absent probe
semaphores.
[0]: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
gdb/Changelog:
2020-01-11 George Barrett <bob@bob131.so>
* stap-probe.c (stap_modify_semaphore): Don't check for null
semaphores.
(stap_probe::set_semaphore, stap_probe::clear_semaphore): Check
for null semaphores.
gdb/testsuite/ChangeLog:
2020-01-11 George Barrett <bob@bob131.so>
* gdb.base/stap-probe.c (relocation_marker): Add dummy variable
to help in finding the image relocation offset.
* gdb.base/stap-probe.exp (stap_test): Accept arbitrary compile
options in arguments.
(stap_test_no_debuginfo): Likewise.
(stap-probe-nosem-noopt-pie, stap-probe-nosem-noopt-nopie): Add
test variants.
(stap_test): Add null semaphore relocation test.
Diffstat (limited to 'libiberty/regex.c')
0 files changed, 0 insertions, 0 deletions