Hi, On Wed, Jul 17, 2024 at 06:34:04PM -0400, Aaron Merey wrote: > From: Heather McIntyre <h...@rice.edu> > > Signed-off-by: Heather S. McIntyre <h...@rice.edu> > Signed-off-by: Aaron Merey <ame...@redhat.com> > Signed-off-by: Mark Wielaard <m...@klomp.org> > > --- > > v2 changes: > This replaces patch "libdw: Add locking around __libdw_dieabbrev for > dwarf_hasattr". Mark suggested that we remove lazy abbrev reading > in order to simplify the locking of __libdw_dieabbrev. This is > a fair bit of work so for now lets just put a write lock around all > of __libdw_dieabbrev. The removal of lazy reading of abbrev will be > done in a future patch.
I have to think a bit about this. It sounds expensive to have to wrap each abbrev read in a lock. > diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c > index dc9b61cb..f7d70d9d 100644 > --- a/libdw/dwarf_setalt.c > +++ b/libdw/dwarf_setalt.c > @@ -35,6 +35,8 @@ > void > dwarf_setalt (Dwarf *main, Dwarf *alt) > { > + rwlock_wrlock(main->dwarf_lock); > + > if (main->alt_fd != -1) > { > INTUSE(dwarf_end) (main->alt_dwarf); > @@ -43,5 +45,7 @@ dwarf_setalt (Dwarf *main, Dwarf *alt) > } > > main->alt_dwarf = alt; > + > + rwlock_unlock(main->dwarf_lock); > } > INTDEF (dwarf_setalt) This part should go with the previous patch "libdw: make dwarf_getalt thread-safe". Cheers, Mark