From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 55A283858D37; Wed, 21 Feb 2024 19:40:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55A283858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1708544405; bh=8t4jN9o2wRH7ptgG67TF8VPRF1RLVWymV35eqWS47sk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YqG5mHGVof/fvAdKE/ME8PrUswizgFm6KlmqH/k3d94aZfznlXxh3nm5EYlOMV/1W QI70TE+1uvm3VxSTle+rLdLr++OPB+FtItZLcWh1688dhZ7waLPCK8BrVD+/zgPIh0 26v5l+juTWMcP1qHbo115MhflXyTGYuhuv/o4tsA= From: "adhemerval.zanella at linaro dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/31405] Switch dl_load_write_lock to rwlock for better ASAN performance Date: Wed, 21 Feb 2024 19:40:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: adhemerval.zanella at linaro dot org 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: cc Message-ID: In-Reply-To: References: 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 Adhemerval Zanella changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |adhemerval.zanella at lina= ro dot o | |rg --- Comment #1 from Adhemerval Zanella --- I think we can use _dl_find_object instead, as used on libbacktrace for oth= er ABIs. The API was designed for exactly this scalability issue and dlfo_eh_frame/dlfo_eh_count maps to PT_ARM_EXIDX vaddr start and length on = ARM. diff --git a/sysdeps/arm/find_exidx.c b/sysdeps/arm/find_exidx.c index d647865e5a..a7a76b09da 100644 --- a/sysdeps/arm/find_exidx.c +++ b/sysdeps/arm/find_exidx.c @@ -16,64 +16,15 @@ . */ #include -#include - -struct unw_eh_callback_data -{ - _Unwind_Ptr pc; - _Unwind_Ptr exidx_start; - int exidx_len; -}; - - -/* Callback to determines if the PC lies within an object, and remember the - location of the exception index table if it does. */ - -static int -find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr) -{ - struct unw_eh_callback_data * data; - const ElfW(Phdr) *phdr; - int i; - int match; - _Unwind_Ptr load_base; - - data =3D (struct unw_eh_callback_data *) ptr; - load_base =3D info->dlpi_addr; - phdr =3D info->dlpi_phdr; - - match =3D 0; - for (i =3D info->dlpi_phnum; i > 0; i--, phdr++) - { - if (phdr->p_type =3D=3D PT_LOAD) - { - _Unwind_Ptr vaddr =3D phdr->p_vaddr + load_base; - if (data->pc >=3D vaddr && data->pc < vaddr + phdr->p_memsz) - match =3D 1; - } - else if (phdr->p_type =3D=3D PT_ARM_EXIDX) - { - data->exidx_start =3D (_Unwind_Ptr) (phdr->p_vaddr + load_base); - data->exidx_len =3D phdr->p_memsz; - } - } - - return match; -} - /* Find the exception index table containing PC. */ _Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount) { - struct unw_eh_callback_data data; - - data.pc =3D pc; - data.exidx_start =3D 0; - if (__dl_iterate_phdr (find_exidx_callback, &data) <=3D 0) + struct dl_find_object data; + if (_dl_find_object ((void *) pc, &data) < 0) return 0; - - *pcount =3D data.exidx_len / 8; - return data.exidx_start; + *pcount =3D data.dlfo_eh_count; + return (_Unwind_Ptr) data.dlfo_eh_frame; } --=20 You are receiving this mail because: You are on the CC list for the bug.=