From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 59417384AB5B; Fri, 3 May 2024 12:49:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59417384AB5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714740588; bh=/9FKU6A+rMc6HIe0nUTQ7YQ4vl0FZi5Wn/KiP6XKGUk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LE7BSU4ieWMAPINjVXtoPnPwucIyTKE+4wuO8ze3SX6abKCCEnDW2elkTmU0ed+5+ n5pxi0MTQtg/w0PmXGdDFpLhzxG+cTi4TVORdTOKeaNv6AXIul1FqjTHlVJs1Y2byW 14qd44Qbn8r/wODxft2YVOI0QYAhopPYueIfiVDY= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/31697] heap-use-after-free in symtab Date: Fri, 03 May 2024 12:49:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31697 --- Comment #5 from Tom de Vries --- At first glance, seems to be an ordering problem. tui_all_objfiles_removed should be executed after symtab_all_objfiles_remov= ed. This demonstrator patch fixes it by calling symtab_all_objfiles_removed at = the start of tui_all_objfiles_removed: ... diff --git a/gdb/symtab.c b/gdb/symtab.c index 58648a8779d..f79c1641cab 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1726,9 +1726,11 @@ symtab_new_objfile_observer (struct objfile *objfile) symbol_cache_flush (objfile->pspace); } +extern void symtab_all_objfiles_removed (program_space *pspace); + /* This module's 'all_objfiles_removed' observer. */ -static void +void symtab_all_objfiles_removed (program_space *pspace) { symbol_cache_flush (pspace); diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index cf48e709ed8..7baebb5e6a8 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -58,9 +58,14 @@ static void tui_new_objfile_hook (struct objfile* objfile) { tui_on_objfiles_changed (); } +extern void symtab_all_objfiles_removed (program_space *pspace); + static void tui_all_objfiles_removed (program_space *pspace) -{ tui_on_objfiles_changed (); } +{ + symtab_all_objfiles_removed (pspace); + tui_on_objfiles_changed (); +} /* Observer for the register_changed notification. */ ... --=20 You are receiving this mail because: You are on the CC list for the bug.=