[PATCH] aarch64: Add MTE mode tunable
Yury Khrustalev
yury.khrustalev@arm.com
Mon Sep 7 09:01:39 GMT 2026
Hi Wilco,
On Fri, Sep 04, 2026 at 02:38:38PM +0000, Wilco Dijkstra wrote:
> Hi Yury,
>
> A few quick comments:
>
> > �struct cpu_features
> > �{
> > �� uint64_t midr_el1;
> > @@ -69,6 +86,7 @@ struct cpu_features
> > �� bool unused;
> > �� bool mops;
> > �� bool sve2;
> > +� bool mte;
> �
> If you're not planning to backport this, you could reuse the "unused" field.
Yes, I think I can do that. No plans to backport this functionality.
>
> �
> > +������ bl����� HIDDEN_JUMPTARGET(__mte_init)
>
> I presume at this point all the cpu-features initialization has been run already?
>
> > +� /* Check if MTE is supported.� */
> > +� cpu_features->mte = GLRO (dl_hwcap2) & HWCAP2_MTE;
> > +� if (cpu_features->mte)
> > +��� TUNABLE_GET (glibc, cpu, mtemode, tunable_val_t *,
> > +��������������� TUNABLE_CALLBACK (set_aarch64_mte_mode));
> > +� else
> > +��� GL (dl_aarch64_mte_mode) = MTE_MODE_DISABLED;
>
> For MTE_MODE_DISABLED, I would expect that cpu_features->mte is set to false too.
> Basically there is no reason to force MTE ifuncs for correctness if we don't enable MTE.
The problem is that GL (dl_aarch64_mte_mode) can be updated later after
we checked binary marking. When this happens (in _rtld_main_check) the
cpu_features->mte field is read-only.
Conceptually, cpu_features->mte only reflects HWCAPs while any
MTE-related ifunc resolvers should also check whether MTE is in the
right state (in addition to having hardware/kernel support).
Cheers,
Yury
More information about the Libc-alpha
mailing list