[PATCH] aarch64: Fix error messages for GCS and BTI incompatible modules
Yury Khrustalev
yury.khrustalev@arm.com
Tue Jan 6 11:19:51 GMT 2026
On Mon, Jan 05, 2026 at 03:51:23PM -0300, Adhemerval Zanella Netto wrote:
>
> On 05/01/26 12:07, Yury Khrustalev wrote:
> > Hi Adhemerval,
> >
> > ...
> >
> > This is a good suggestion but on a closer inspection this approach
> > misses case where we have both non-empty program and l_name (it
> > corresponds to the situation when the issue is found in one of the
> > dependencies of a dynamically linked program), and we'd like to have a
> > nice message in this case that would include both program name and the
> > library name.
> >
> > In general, this code is run when we have already failed and are trying
> > to make a nice error message. Does it matter if we do a bit more checks?
> > I also think current code looks a bit more readable. Maybe it would be
> > OK to leave this patch as is?
> >
>
> Indeed, I tried to restructure the code because the STR_NOT_EMPTY macro
> is misleading that l->l_name might be NULL (although not incorrect).
> Maybe something like then:
>
> if (program != NULL)
> {
> if (program[0] != '\0' && l->l_name[0] != '\0')
> /* A program's dependency is not GCS compatible. */
> _dl_fatal_printf ("%s: %s: failed to turn on BTI protection\n",
> program, l->l_name);
> if (program[0] != '\0')
> /* The program itself is not GCS compatible. */
> _dl_fatal_printf ("%s: failed to turn on BTI protection\n", program);
>
> /* For static binaries, program will be an empty string. */
> _dl_fatal_printf ("error: failed to turn on BTI protection\n");
> }
> else
> /* If program is NULL, we are processing a dlopen operation.
> Note: the errno value is not available any more. */
> _dl_signal_error (0, l->l_name, "dlopen",
> "failed to turn on BTI protection");
Thanks for the feedback. I've sent v2 [1].
[1]: https://inbox.sourceware.org/libc-alpha/20260106111759.3785728-1-yury.khrustalev@arm.com/
More information about the Libc-alpha
mailing list