From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5F8D338708C2; Thu, 19 Nov 2020 16:22:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F8D338708C2 From: "mark at klomp dot org" To: elfutils-devel@sourceware.org Subject: [Bug libdw/26921] New: dwarf_getalt () not thread-safe Date: Thu, 19 Nov 2020 16:22:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: libdw X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark at klomp dot 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2020 16:22:32 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26921 Bug ID: 26921 Summary: dwarf_getalt () not thread-safe Product: elfutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libdw Assignee: unassigned at sourceware dot org Reporter: mark at klomp dot org CC: elfutils-devel at sourceware dot org Target Milestone: --- When walking a DIE tree getting any attribute values that come from an alt = file (or DWARF5 supplemental file) is not thread-safe. The dwarf_getalt () funct= ion does the following (without any locking): Dwarf * dwarf_getalt (Dwarf *main) { /* Only try once. */ if (main =3D=3D NULL || main->alt_dwarf =3D=3D (void *) -1) return NULL; if (main->alt_dwarf !=3D NULL) return main->alt_dwarf; find_debug_altlink (main); /* If we found nothing, make sure we don't try again. */ if (main->alt_dwarf =3D=3D NULL) { main->alt_dwarf =3D (void *) -1; return NULL; } return main->alt_dwarf; } find_debug_altlink will search for the alt file (which is a normal ELF file, that will be opened with dwarf_begin) if it can be found (and no error occu= rs). The rest of the code (except for dwarf_end and an explicit dwarf_setalt cal= l) doesn't access dwarf->alt_dwarf directly, but all call dwarf_getalt to acce= ss it. --=20 You are receiving this mail because: You are on the CC list for the bug.=