[compiler-rt] [HWASan] Prevent same tag for adjacent heap objects (PR #69337)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 13:30:47 PDT 2023
================
@@ -156,6 +156,35 @@ tag_t Thread::GenerateRandomTag(uptr num_bits) {
return tag;
}
+// Generate a (pseudo-)random non-zero tag and prevent collisions to neighboring
+// objects.
+tag_t Thread::GenerateRandomNonCollidingTag(uptr prev_ptr, uptr foll_ptr,
+ uptr num_bits) {
+ DCHECK_GT(num_bits, 0);
+ if (tagging_disabled_)
+ return 0;
+ tag_t tag;
+ tag_t previous_tag = *(tag_t *)MemToShadow(prev_ptr);
----------------
vitalybuka wrote:
Out allocator fast path getting heavier and heavier. More memory loads and conditional branches here.
I would rather like to see us go in opposite detection, cleaning up conditions, even if it slightly increase probability of misses.
https://github.com/llvm/llvm-project/pull/69337
More information about the llvm-commits
mailing list