[PATCH] D69051: Handle libhwasan system allocator fallback during thread initialisation
Matthew Malcomson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 10:11:52 PDT 2019
mmalcomson updated this revision to Diff 225655.
mmalcomson edited the summary of this revision.
mmalcomson added a comment.
Now avoid returning a zero tag when tagging is disabled.
I've avoided that by returning a fixed non-zero tag from Thread::GenerateRandomTag.
NOTE: There's the same basic problem of tagging with zero going to the system allocator free when setting HWASAN_OPTIONS `tag_in_malloc=false`. I intend to fix that in a separate patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69051/new/
https://reviews.llvm.org/D69051
Files:
compiler-rt/lib/hwasan/hwasan_thread.cpp
Index: compiler-rt/lib/hwasan/hwasan_thread.cpp
===================================================================
--- compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -108,7 +108,15 @@
// Generate a (pseudo-)random non-zero tag.
tag_t Thread::GenerateRandomTag() {
- if (tagging_disabled_) return 0;
+ // Return non-zero when tagging is not disabled so that the allocator
+ // fallback knows whatever pointer is being created has not come from the
+ // system allocator.
+ if (tagging_disabled_)
+#if HWASAN_WITH_INTERCEPTORS
+ return flags()->disable_allocator_tagging ? 0 : 0x10;
+#else
+ return 0;
+#endif
tag_t tag;
do {
if (flags()->random_tags) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69051.225655.patch
Type: text/x-patch
Size: 721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191018/aa1a5235/attachment.bin>
More information about the llvm-commits
mailing list