[Bug libdw/26930] New: tsearch/tfind tree caches need locking

mark at klomp dot org sourceware-bugzilla@sourceware.org
Sat Nov 21 21:58:19 GMT 2020


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.


More information about the Elfutils-devel mailing list