mte: disable write-after-free check for slab allocations when MTE is on

Freed slab memory is tagged with a reserved tag value that is never used for live allocations.
This commit is contained in:
Dmitry Muhomor 2023-10-26 10:17:21 +03:00
parent 52fcaf55d6
commit d80e2f232c

View File

@ -464,6 +464,12 @@ static void write_after_free_check(const char *p, size_t size) {
return;
}
#ifdef HAS_ARM_MTE
if (likely(is_memtag_enabled())) {
return;
}
#endif
for (size_t i = 0; i < size; i += sizeof(u64)) {
if (unlikely(*(const u64 *)(const void *)(p + i))) {
fatal_error("detected write after free");