[PATCH] aarch64: Add MTE mode tunable

Wilco Dijkstra Wilco.Dijkstra@arm.com
Mon Sep 7 09:43:56 GMT 2026


Hi Yury,

>> 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).

Then this should check dl_aarch64_mte_mode is not disabled rather than a HWCAP:

-  bool __attribute__((unused)) mte = GLRO(dl_hwcap2) & HWCAP2_MTE;           \
+  bool __attribute__((unused)) mte = GLRO(dl_aarch64_cpu_features).mte;              \

This code was always flawed since unlike SVE/MOPS, MTE ifuncs do not depend on MTE.

Cheers,
Wilco


More information about the Libc-alpha mailing list