On Thu, Mar 13, 2025 at 6:55 AM John Dallman <
jgdats...@gmail.com> wrote:
>
> OK, so my course of action seems to be:
>
> Acquire a device where I can turn on MTE. This needs to be ARMv9, but that's not a problem these days.
it's a bit more tricky than that in practice, because you need
bootloader support to actually enable mte. (similar to how you might
have a 64-bit capable chip running a 32-bit kernel or 32-bit
userspace, you need more than just a _chip_ that supports mte
instructions.)
afaik
https://developer.android.com/ndk/guides/arm-mte#hwsupport are
the only devices where you can just buy a stock phone off the shelf
and use mte. (if any oem has additional stock phones that support mte,
let me know and i'll make sure you get added to the list!)
> Test a build that is not compiled for MTE on that, with MTE turned on via the environment variable . That gives me MTE checks for heap. If this is (nearly) as fast as running without MTE, consider running my testing with this as standard.
> Do an MTE-compiled build and test that under MTE. This will be significantly slower than the non-MTE build, and will only run on ARMv9, so should not be shipped.
define "significantly". it's a low single-digit percent cost...
> There might be a case for shipping MTE-compiled code for software that is all about security, rather than performance, but I don't produce that.
...so it really comes down to this "do i care about every last bit of
performance, or every last bit of debuggability/mitigation?" tradeoff.
certainly if you're already doing hwasan debugging/testing, you should
consider using mte instead. (and especially if you're actively chasing
a memory error ... sync mode might be too expensive for normal use --
where you might be using asymm instead -- but having the exact
problematic load/store fault can be invaluable for debugging.)
> To view this discussion visit
https://groups.google.com/d/msgid/android-ndk/CAH1xqgkG%2BsnXpD%2BBst78nri3exNvgNuChZ2sVg_8Jfo9%2Bucf4Q%40mail.gmail.com.