From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.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 [thread overview]
Message-ID: <bug-26921-10460@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=26921
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 () function
does the following (without any locking):
Dwarf *
dwarf_getalt (Dwarf *main)
{
/* Only try once. */
if (main == NULL || main->alt_dwarf == (void *) -1)
return NULL;
if (main->alt_dwarf != NULL)
return main->alt_dwarf;
find_debug_altlink (main);
/* If we found nothing, make sure we don't try again. */
if (main->alt_dwarf == NULL)
{
main->alt_dwarf = (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 occurs).
The rest of the code (except for dwarf_end and an explicit dwarf_setalt call)
doesn't access dwarf->alt_dwarf directly, but all call dwarf_getalt to access
it.
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2020-11-19 16:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 16:22 mark at klomp dot org [this message]
2020-11-20 19:11 ` [Bug libdw/26921] " woodard at redhat dot com
2020-11-20 19:13 ` woodard at redhat dot com
2020-11-20 19:17 ` woodard at redhat dot com
2020-11-20 19:20 ` woodard at redhat dot com
2020-11-20 19:26 ` woodard at redhat dot com
2020-11-20 19:43 ` woodard at redhat dot com
2020-11-21 22:00 ` mark at klomp dot org
2020-11-21 23:34 ` woodard at redhat dot com
2020-11-21 23:53 ` mark at klomp dot org
2023-10-06 11:15 ` mark at klomp dot org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-26921-10460@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).