[PATCH 1/1] aarch64: Add LD_DEBUG=protect to log BTI and GCS warnings

Yury Khrustalev yury.khrustalev@arm.com
Mon Dec 15 13:47:11 GMT 2025


Hello Florian,

Thanks for your comments, all makes sense, I'm responding below inline.

On Mon, Dec 08, 2025 at 03:48:30PM +0100, Florian Weimer wrote:
> * Yury Khrustalev:
> 
> > diff --git a/misc/tst-dl-debug-protect.sh b/misc/tst-dl-debug-protect.sh
> > new file mode 100644
> > ..
> >
> Should this go into elf/?

Yes, I think it's better to move this script in elf/

> And it's not actually a test, but a
> building block for tests.  So the file header should say so, and maybe
> add a comment about how the script is expected to be used.

Good point. I'll fix the header and add comments explaining the command
line arguments for this script.

> > ...
> >
> > diff --git a/sysdeps/aarch64/dl-gcs.c b/sysdeps/aarch64/dl-gcs.c
> > index 4ac86a5d6f..853929aa82 100644
> > --- a/sysdeps/aarch64/dl-gcs.c
> > +++ b/sysdeps/aarch64/dl-gcs.c
> > @@ -61,6 +61,9 @@ check_gcs (struct link_map *l, const char *program, bool enforced)
> >    /* Binary is marked, all good.  */
> >    if (l->l_mach.gcs)
> >      return true;
> > +  if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_PROTECT))
> > +    _dl_debug_printf ("AArch64 GCS: unmarked module %s\n",
> > +		      l->l_name && l->l_name[0] ? l->l_name : program);
> >    /* Binary is not marked and loaded via dlopen: abort.  */
> >    if (program == NULL)
> >      fail (l, program);
> 
> The log messages should somehow related this with “projection”, so
> that it is clearer what they imply to someone who uses LD_DEBUG=all,
> but doesn't know about BTI/GCS.

Agreed. I'll prefix messages with "protection: ".

> I'm not sure if “unmarked” is clear enough in this context.  It could
> be interpreted as an unmarking action taken by the dynamic linker.
> Perhaps “incompatible” is clearer?

I didn't realise this term was already used in the context of dynamic
linker. Good point, I'll change it to "not compatible with".

> Is there a “marked as incompatible” state?

We already use "not compatible with GCS" in an error message, so I think
we should do the same for this debug logging.

>

I'll send new version of this patch shortly. It would be easier if my
another change [1] is merged first.

[1]: https://inbox.sourceware.org/libc-alpha/20251212121440.1841246-1-yury.khrustalev@arm.com/

Kind regards,
Yury



More information about the Libc-alpha mailing list