[compiler-rt] [HWASan] Prevent same tag for adjacent heap objects (PR #69337)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 08:01:21 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);
----------------
KonradHohentanner wrote:
For sure it is a trade-off. For my work it was more important that the crash behavior stays as consistent as possible, to prevent spending time debugging. For what it's worth I did not measure a performance impact for these changes (using spec cpu). Of course that might be different for a larger fuzzing campaign with recurring metadata initialization.
https://github.com/llvm/llvm-project/pull/69337
More information about the llvm-commits
mailing list