From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41151386F036; Thu, 7 Jan 2021 13:40:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41151386F036 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug remote/26614] AddressSanitizer: heap-use-after-free of extended_remote_target in remote_async_inferior_event_handler Date: Thu, 07 Jan 2021 13:40:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: remote X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 10.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 13:40:30 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26614 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |10.2 --- Comment #24 from Tom de Vries --- (In reply to Pedro Alves from comment #20) > target_ops is reference counted. Wouldn't this patch fix the issue? >=20 > diff --git c/gdb/remote.c w/gdb/remote.c > index 71f814efb36..5a5ac1ee92f 100644 > --- c/gdb/remote.c > +++ w/gdb/remote.c > @@ -14174,9 +14174,13 @@ remote_async_serial_handler (struct serial *scb, > void *context) > static void > remote_async_inferior_event_handler (gdb_client_data data) > { > + remote_target *remote =3D (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 =3D target_ops_ref::new_reference (remote); > + > inferior_event_handler (INF_REG_EVENT); >=20=20 > - remote_target *remote =3D (remote_target *) data; > remote_state *rs =3D remote->get_remote_state (); >=20=20 > /* inferior_event_handler may have consumed an event pending on the Submitted: https://sourceware.org/pipermail/gdb-patches/2021-January/174760.html --=20 You are receiving this mail because: You are on the CC list for the bug.=