[PATCH v3 2/4] aarch64: Add glibc.cpu.aarch64_bti tunable
Yury Khrustalev
yury.khrustalev@arm.com
Fri Nov 28 09:23:16 GMT 2025
On Thu, Nov 27, 2025 at 03:51:35PM -0300, Adhemerval Zanella Netto wrote:
> I think this patch should be merged with the following one, since I do
> see much logic of adding the documentation and the tunable without the
> enforcement logic.
I'm happy to do this, but here I followed the same pattern as when we
added GCS tunable. I also thought separate commit allows for easier code
review.
> On 26/11/25 13:45, Yury Khrustalev wrote:
> > ---
> > ...
> >
> > diff --git a/manual/tunables.texi b/manual/tunables.texi
> >
> > ...
> >
> > +@deftp Tunable glibc.cpu.aarch64_bti
> > +This tunable controls Branch Target Identification (BTI) handling for the
> > +process. This handling is implemented via protecting the memory mapping
> > +with @code{PROT_BTI} for modules that are marked with the appropriate ELF
> > +property.
>
> Maybe that this is enable with the presence of GNU_PROPERTY_AARCH64_FEATURE_1_AND
> along with GNU_PROPERTY_AARCH64_FEATURE_1_BTI. I think it can be useful
> add more context on the manual.
I wouldn't want to duplicate information explained elsewhere (and risk
having to maintain this place in the manual should the reference spec
change in the future. Also, we'd have to do it twice: for BTI and GCS
which doesn't seem right. I will add a link to the external document
though as this would indeed be helpful. Would it be OK?
> > ...
> >
> > diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
> > index 20966e0478..20083b1475 100644
> > --- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
> > +++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
> > @@ -56,5 +56,21 @@ PROCINFO_CLASS struct cpu_features _dl_aarch64_cpu_features
> > # endif
> > #endif
> >
> > +#if !IS_IN (ldconfig)
> > +# if !defined PROCINFO_DECL && defined SHARED
> > + ._dl_aarch64_bti
> > +# else
> > +PROCINFO_CLASS unsigned long _dl_aarch64_bti
>
> Does it need to be an unsigned long? From the manual documentation
> a boot is should suffice.
I've made it along the lines of how we did the GCS tunable. We could
probably cut it down to uint32 and have enough space for (unlikely)
future extension.
Thanks,
Yury
More information about the Libc-alpha
mailing list