From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 38E6E3858D34; Wed, 21 Feb 2024 16:15:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38E6E3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1708532109; bh=kw6j1KwB95zZpN61JFfmryz5K6V/DUChC+mSvXHEbEI=; h=From:To:Subject:Date:From; b=hrtJOrado42JKzeJKNIscSIwxVinc+gHqYS5KKbtKkw01qCkLoohewSeHKp1Jk3Ru mYaL9yA465+NOLaDv/Nj5Jg29rF6eVIuEsSodYh+XUgfKLriSTW5drtYjaa784RxEX TP84zImhZJNO6icdO9gq6y5R1o3UyBSUhRBnSsy4= From: "fhsueh at roku dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31405] New: Switch dl_load_write_lock to rwlock for better ASAN performance Date: Wed, 21 Feb 2024 16:15:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.39 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: fhsueh at roku dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31405 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 (A= SAN) 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 AS= AN 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 wh= ich would allow concurrent reads. Example stack from free(): #0 0x6065f4b8 in find_exidx_callback (info=3D, size=3D, ptr=3D0x507a74fc) at ../sysdeps/arm/find_exidx.c:48 #1 0x6065e6a4 in __GI___dl_iterate_phdr (callback=3D0x6956d5a0, data=3D0x6= 065e6a4 <__GI___dl_iterate_phdr+364>, data@entry=3D0x507a74f4) at dl-iteratephdr.c:= 76 #2 0x6065f518 in __gnu_Unwind_Find_exidx (pc=3Dpc@entry=3D1660388795, pcount=3D0x507a751c, pcount@entry=3D0x507a7514) at ../sysdeps/arm/find_exid= x.c:74 #3 0x606b1fb0 in get_eit_entry (ucbp=3Ducbp@entry=3D0x507a7530, return_address=3D1660388795) at gcc/libgcc/unwind-arm-common.inc:276 #4 0x606b2544 in __gnu_Unwind_Backtrace (trace=3D0x69046978 <__sanitizer::(anonymous namespace)::Unwind_Trace(_Unwind_Context*, void*)>, trace_argument=3D0x507a77d8, entry_vrs=3D) 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=3D0x507= a7858, pc=3Dpc@entry=3D1761766388, max_depth=3Dmax_depth@entry=3D30) at gcc/libsanitizer/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130 #7 0x6903f6e4 in __sanitizer::BufferedStackTrace::Unwind (this=3Dthis@entry=3D0x507a7858, max_depth=3D30, max_depth@entry=3D17617664= 36, pc=3Dpc@entry=3D1761766388, bp=3Dbp@entry=3D1350204548, context=3Dcontext@e= ntry=3D0x0, stack_top=3Dstack_top@entry=3D1350214408, stack_bottom=3D1349169152, request_fast_unwind=3Drequest_fast_unwind@entry=3Dfalse) at gcc/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:157 #8 0x6902eff4 in __sanitizer::BufferedStackTrace::UnwindImpl (this=3D0x507= a7858, pc=3D1761766388, bp=3D1350204548, context=3D0x0, request_fast=3Dfalse, max_= depth=3D30) at gcc/libsanitizer/asan/asan_stack.cpp:77 #9 0x68fa6f58 in __sanitizer::BufferedStackTrace::Unwind (this=3Dthis@entry=3D0x507a7858, pc=3Dpc@entry=3D1761766388, bp=3Dbp@entry= =3D1350204548, context=3Dcontext@entry=3D0x0, request_fast=3Drequest_fast@entry=3Dfalse, m= ax_depth=3D30) at gcc/libsanitizer/sanitizer_common/sanitizer_stacktrace.h:131 #10 0x69026c24 in __interceptor_free (ptr=3D0x4e124af0) at gcc/libsanitizer/asan/asan_malloc_linux.cpp:52 ... --=20 You are receiving this mail because: You are on the CC list for the bug.=