public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31405] New: Switch dl_load_write_lock to rwlock for better ASAN performance
@ 2024-02-21 16:15 fhsueh at roku dot com
  2024-02-21 19:40 ` [Bug libc/31405] " adhemerval.zanella at linaro dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fhsueh at roku dot com @ 2024-02-21 16:15 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 31405
           Summary: Switch dl_load_write_lock to rwlock for better ASAN
                    performance
           Product: glibc
           Version: 2.39
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: fhsueh at roku dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

A performance bottleneck in the runtime performance of Address Sanitizer (ASAN)
is that a call to _dl_iterate_phdr() is made as part of malloc / free for
memory tracking. This function acquires the GL(dl_load_write_lock) mutex,
effectively serializing and slowing all these operations. As much of the ASAN
locking is for read operations, the data protected by this is dominated by read
and by few writes. An improvement can be made to change this to a RWLock which
would allow concurrent reads.

Example stack from free():
#0  0x6065f4b8 in find_exidx_callback (info=<optimized out>, size=<optimized
out>, ptr=0x507a74fc) at ../sysdeps/arm/find_exidx.c:48
#1  0x6065e6a4 in __GI___dl_iterate_phdr (callback=0x6956d5a0, data=0x6065e6a4
<__GI___dl_iterate_phdr+364>, data@entry=0x507a74f4) at dl-iteratephdr.c:76
#2  0x6065f518 in __gnu_Unwind_Find_exidx (pc=pc@entry=1660388795,
pcount=0x507a751c, pcount@entry=0x507a7514) at ../sysdeps/arm/find_exidx.c:74
#3  0x606b1fb0 in get_eit_entry (ucbp=ucbp@entry=0x507a7530,
return_address=1660388795) at gcc/libgcc/unwind-arm-common.inc:276
#4  0x606b2544 in __gnu_Unwind_Backtrace (trace=0x69046978
<__sanitizer::(anonymous namespace)::Unwind_Trace(_Unwind_Context*, void*)>,
trace_argument=0x507a77d8, entry_vrs=<optimized out>) at
gcc/libgcc/unwind-arm-common.inc:768
#5  0x606b2ef4 in _Unwind_Backtrace () at gcc/libgcc/config/arm/libunwind.S:360
#6  0x69046b8c in __sanitizer::BufferedStackTrace::UnwindSlow (this=0x507a7858,
pc=pc@entry=1761766388, max_depth=max_depth@entry=30) at
gcc/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130
#7  0x6903f6e4 in __sanitizer::BufferedStackTrace::Unwind
(this=this@entry=0x507a7858, max_depth=30, max_depth@entry=1761766436,
pc=pc@entry=1761766388, bp=bp@entry=1350204548, context=context@entry=0x0,
stack_top=stack_top@entry=1350214408, stack_bottom=1349169152,
request_fast_unwind=request_fast_unwind@entry=false) at
gcc/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:157
#8  0x6902eff4 in __sanitizer::BufferedStackTrace::UnwindImpl (this=0x507a7858,
pc=1761766388, bp=1350204548, context=0x0, request_fast=false, max_depth=30) at
gcc/libsanitizer/asan/asan_stack.cpp:77
#9  0x68fa6f58 in __sanitizer::BufferedStackTrace::Unwind
(this=this@entry=0x507a7858, pc=pc@entry=1761766388, bp=bp@entry=1350204548,
context=context@entry=0x0, request_fast=request_fast@entry=false, max_depth=30)
at gcc/libsanitizer/sanitizer_common/sanitizer_stacktrace.h:131
#10 0x69026c24 in __interceptor_free (ptr=0x4e124af0) at
gcc/libsanitizer/asan/asan_malloc_linux.cpp:52
...

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

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

end of thread, other threads:[~2024-02-24 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 16:15 [Bug libc/31405] New: Switch dl_load_write_lock to rwlock for better ASAN performance fhsueh at roku dot com
2024-02-21 19:40 ` [Bug libc/31405] " adhemerval.zanella at linaro dot org
2024-02-22 19:07 ` malcolm.parsons at gmail dot com
2024-02-23 11:51 ` adhemerval.zanella at linaro dot org
2024-02-24 15:51 ` fw at deneb dot enyo.de
2024-02-24 15:52 ` [Bug libc/31405] Improve dl_iterate_phdr using _dl_find_object fw at deneb dot enyo.de
2024-02-24 16:15 ` sam at gentoo 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).