Hi Aaron,

On Fri, 2026-10-30 at 12:08 -0400, Aaron Merey wrote:
> asm_align acquires asmscn->ctx->lock wrlock before updating a parent
> asmscn's alignment.  While doing this asm_align also attempts to acquire
> the parent asmscn's wrlock.  The parent and child share the same ctx,
> causing an EDEADLK error.
> 
> Fix this by removing the inner acquisition of the wrlock.  Since the ctx
> is shared, this inner acquisition is redundant.

Yes, this looks correct.

Also libasm is a little odd in that it cannot really be used...
You need an Ebl handle to create an AsmCtx_t with asm_begin.
But Ebl isn't a public type...

Cheers,

Mark

> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  libasm/asm_align.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/libasm/asm_align.c b/libasm/asm_align.c
> index 19ec9a13..65d3198f 100644
> --- a/libasm/asm_align.c
> +++ b/libasm/asm_align.c
> @@ -112,12 +112,8 @@ asm_align (AsmScn_t *asmscn, GElf_Word value)
>        /* Update the parent as well (if it exists).  */
>        if (asmscn->subsection_id != 0)
>       {
> -       rwlock_wrlock (asmscn->data.up->ctx->lock);
> -
>         if (asmscn->data.up->max_align < value)
>           asmscn->data.up->max_align = value;
> -
> -       rwlock_unlock (asmscn->data.up->ctx->lock);
>       }
>      }
>  

Reply via email to