mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-20 21:34:23 -05:00
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:
parent
e3686ae457
commit
70c91f4c3e
@ -464,6 +464,12 @@ static void write_after_free_check(const char *p, size_t size) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_ARM_MTE
|
||||||
|
if (likely(is_memtag_enabled())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i += sizeof(u64)) {
|
for (size_t i = 0; i < size; i += sizeof(u64)) {
|
||||||
if (unlikely(*(const u64 *)(const void *)(p + i))) {
|
if (unlikely(*(const u64 *)(const void *)(p + i))) {
|
||||||
fatal_error("detected write after free");
|
fatal_error("detected write after free");
|
||||||
|
Loading…
Reference in New Issue
Block a user