Hi Aaron,

On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote:
>       * libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock.
> 
> Signed-off-by: Aaron Merey <ame...@redhat.com>
> ---
> v2 changes: Lock only for the duration of __libdw_findcu.

__libdw_findcu already has internal locking.
Isn't that enough?

>  libdw/dwarf_offdie.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c
> index 883720de..a9729947 100644
> --- a/libdw/dwarf_offdie.c
> +++ b/libdw/dwarf_offdie.c
> @@ -58,7 +59,10 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die 
> *result,
>    result->addr = (char *) data->d_buf + offset;
>  
>    /* Get the CU.  */
> +  mutex_lock (dbg->dwarf_lock);
>    result->cu = __libdw_findcu (dbg, offset, debug_types);
> +  mutex_unlock (dbg->dwarf_lock);
> +
>    if (result->cu == NULL)
>      {
>        /* This should never happen.  The input file is malformed.  */

Or if it is needed here, should it also be added in other places where
__libdw_findcu is called? dwarf_cu_dwp_section_info,
dwarf_die_addr_die, dwarf_get_units, dwarf_getaranges, ...

Cheers,

Mark

Reply via email to