diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-01-03 10:18:48 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-01-03 10:18:48 +0100 |
commit | 08fd407675396cf9500519f02033e6cec270a4a6 (patch) | |
tree | 040fc440e58e090766cfd8c697fc87fe726054da /bfd/cpu-ns32k.c | |
parent | fdbd297027e61f03192f73a4d888f91b3d0dfbbb (diff) | |
download | gdb-08fd407675396cf9500519f02033e6cec270a4a6.zip gdb-08fd407675396cf9500519f02033e6cec270a4a6.tar.gz gdb-08fd407675396cf9500519f02033e6cec270a4a6.tar.bz2 |
[gdb] Fix segfault during inferior call to ifunc
With a simple test-case:
...
$ cat test.c
char *p = "a";
int main (void) {
return strlen (p);
}
$ gcc -g test.c
...
we run into this segfault:
...
$ gdb -q -batch a.out -ex start -ex "p strlen (p)"
Temporary breakpoint 1 at 0x1151: file test.c, line 4.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Temporary breakpoint 1, main () at test.c:4
4 return strlen (p);
Fatal signal: Segmentation fault
...
The strlen is an ifunc, and consequently during the call to
call_function_by_hand_dummy for "p strlen (p)" another call
to call_function_by_hand_dummy is used to resolve the ifunc.
This invalidates the get_current_frame () result in the outer call.
Fix this by using prepare_reinflate and reinflate.
Note that this series (
https://inbox.sourceware.org/gdb-patches/20221214033441.499512-1-simon.marchi@polymtl.ca/ )
should address this problem, but this patch is a simpler fix which is easy to
backport.
Tested on x86_64-linux.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
PR gdb/29941
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29941
Diffstat (limited to 'bfd/cpu-ns32k.c')
0 files changed, 0 insertions, 0 deletions