Accepting request 852888 from home:tomdevries:branches:devel:gcc-gdb-fix-remote-async-inferior-event-handler

- Patches to be upstreamed:
  * gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch

OBS-URL: https://build.opensuse.org/request/show/852888
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=266
This commit is contained in:
Michael Matz 2020-12-07 14:39:31 +00:00 committed by Git OBS Bridge
parent fede37b82a
commit ecf4346789
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,28 @@
[gdb] Fix use of invalid pointer in remote_async_inferior_event_handler
As proposed by palves here (
https://sourceware.org/bugzilla/show_bug.cgi?id=26614#c20 ).
---
gdb/remote.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index ba9e6d6e9b..556de6033f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14163,9 +14163,13 @@ remote_async_serial_handler (struct serial *scb, void *context)
static void
remote_async_inferior_event_handler (gdb_client_data data)
{
+ remote_target *remote = (remote_target *) data;
+ /* Hold a strong reference to the remote target while handling an
+ event, since that could result in closing the connection. */
+ auto remote_ref = target_ops_ref::new_reference (remote);
+
inferior_event_handler (INF_REG_EVENT);
- remote_target *remote = (remote_target *) data;
remote_state *rs = remote->get_remote_state ();
/* inferior_event_handler may have consumed an event pending on the

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Nov 30 15:43:58 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Patches to be upstreamed:
* gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch
-------------------------------------------------------------------
Mon Nov 30 14:46:49 UTC 2020 - Tom de Vries <tdevries@suse.com>

View File

@ -294,6 +294,7 @@ Patch1510: gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch
Patch1511: gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch
Patch1512: gdb-tui-enable-work-around-libncurses-segfault.patch
Patch1513: gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch
Patch1514: gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch
# Backports from master
@ -702,6 +703,7 @@ find -name "*.info*"|xargs rm -f
%patch1511 -p1
%patch1512 -p1
%patch1513 -p1
%patch1514 -p1
%patch2000 -p1
%patch2002 -p1