public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug libdw/26930] New: tsearch/tfind tree caches need locking
@ 2020-11-21 21:58 mark at klomp dot org
  2020-11-24 12:17 ` [Bug libdw/26930] " mail at milianw dot de
  2023-10-06 11:16 ` mark at klomp dot org
  0 siblings, 2 replies; 3+ messages in thread
From: mark at klomp dot org @ 2020-11-21 21:58 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=26930

            Bug ID: 26930
           Summary: tsearch/tfind tree caches need locking
           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: ---

libdw uses various search trees as (lazy) caches.

Specifically struct Dwarf has:

  /* Search tree for the CUs.  */
  void *cu_tree;
  Dwarf_Off next_cu_offset;

  /* Search tree and sig8 hash table for .debug_types type units.  */
  void *tu_tree;
  Dwarf_Off next_tu_offset;
  Dwarf_Sig8_Hash sig8_hash;

  /* Search tree for split Dwarf associated with CUs in this debug.  */
  void *split_tree;

  /* Search tree for .debug_macro operator tables.  */
  void *macro_ops;

  /* Search tree for decoded .debug_line units.  */
  void *files_lines;

struct Dwarf_CU has:

  /* Known location lists.  */
  void *locs;

struct Dwarf_CFI_s has:

  /* Search tree for the CIEs, indexed by CIE_pointer (section offset).  */
  void *cie_tree;

  /* Search tree for the FDEs, indexed by PC address.  */
  void *fde_tree;

  /* Search tree for parsed DWARF expressions, indexed by raw pointer.  */
  void *expr_tree;

struct Dwfl_Module has:

  void *lazy_cu_root;           /* Table indexed by Dwarf_Off of CU.  */

When used in a concurrent program they need to be read locked when searched
(with tfind) and write locked when updating (with tsearch).

See several backtraces in bug #26921 which describes a different concurrent
unsafe update mechanism.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libdw/26930] tsearch/tfind tree caches need locking
  2020-11-21 21:58 [Bug libdw/26930] New: tsearch/tfind tree caches need locking mark at klomp dot org
@ 2020-11-24 12:17 ` mail at milianw dot de
  2023-10-06 11:16 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mail at milianw dot de @ 2020-11-24 12:17 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=26930

Milian Wolff <mail at milianw dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mail at milianw dot de

--- Comment #1 from Milian Wolff <mail at milianw dot de> ---
as a suggestion to catch and fix these issues: if there'd be a unit test that
runs through the "supposedly thread safe" API, one could compile it with tsan
and verify that the code is actually thread safe. with elfutils using plain c,
tsan should work pretty well from what I know.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libdw/26930] tsearch/tfind tree caches need locking
  2020-11-21 21:58 [Bug libdw/26930] New: tsearch/tfind tree caches need locking mark at klomp dot org
  2020-11-24 12:17 ` [Bug libdw/26930] " mail at milianw dot de
@ 2023-10-06 11:16 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2023-10-06 11:16 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=26930

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
https://inbox.sourceware.org/elfutils-devel/CAK-+vz0guN1=D5-EcuRTQAF0ZnL+aGYFg4n7pguuMkwNiOmW1Q@mail.gmail.com/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-06 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 21:58 [Bug libdw/26930] New: tsearch/tfind tree caches need locking mark at klomp dot org
2020-11-24 12:17 ` [Bug libdw/26930] " mail at milianw dot de
2023-10-06 11:16 ` mark at klomp dot org

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).