[PATCH] elf: Check objname before calling fatal_error

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Apr 8 16:47:41 GMT 2024



On 08/04/24 13:06, H.J. Lu wrote:
> _dl_signal_error may be called with objname == NULL.  _dl_exception_create
> checks objname == NULL.  But fatal_error doesn't.  Check objname before
> calling fatal_error.  This fixes BZ #31596.

Do we have a reproducer for this? The one from BZ#31596 does seems to trigger
it.

> ---
>  elf/dl-catch.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/elf/dl-catch.c b/elf/dl-catch.c
> index 2109516dba..8ef7a4c706 100644
> --- a/elf/dl-catch.c
> +++ b/elf/dl-catch.c
> @@ -126,7 +126,11 @@ _dl_signal_error (int errcode, const char *objname, const char *occasion,
>        __longjmp (lcatch->env[0].__jmpbuf, 1);
>      }
>    else
> -    fatal_error (errcode, objname, occasion, errstring);
> +    {
> +      if (objname == NULL)
> +	objname = "";
> +      fatal_error (errcode, objname, occasion, errstring);
> +    }
>  }
>  rtld_hidden_def (_dl_signal_error)
>  


More information about the Libc-alpha mailing list