diff --git a/compiler-rt/lib/scudo/standalone/linux.cpp b/compiler-rt/lib/scudo/standalone/linux.cpp --- a/compiler-rt/lib/scudo/standalone/linux.cpp +++ b/compiler-rt/lib/scudo/standalone/linux.cpp @@ -58,11 +58,8 @@ if (Flags & MAP_MEMTAG) MmapProt |= PROT_MTE; #endif - if (Addr) { - // Currently no scenario for a noaccess mapping with a fixed address. - DCHECK_EQ(Flags & MAP_NOACCESS, 0); + if (Addr) MmapFlags |= MAP_FIXED; - } void *P = mmap(Addr, Size, MmapProt, MmapFlags, -1, 0); if (P == MAP_FAILED) { if (!(Flags & MAP_ALLOWNOMEM) || errno != ENOMEM) diff --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "memtag.h" #include "tests/scudo_unit_test.h" #include "allocator_config.h" @@ -181,6 +182,10 @@ static bool Ready; static void performAllocations(LargeAllocator *L) { + scudo::Options options; + if (scudo::archSupportsMemoryTagging()) + options.Val = + 1U << static_cast(scudo::OptionBit::UseMemoryTagging); std::vector V; const scudo::uptr PageSize = scudo::getPageSizeCached(); { @@ -191,14 +196,14 @@ for (scudo::uptr I = 0; I < 128U; I++) { // Deallocate 75% of the blocks. const bool Deallocate = (rand() & 3) != 0; - void *P = L->allocate(scudo::Options{}, (std::rand() % 16) * PageSize); + void *P = L->allocate(options, (std::rand() % 16) * PageSize); if (Deallocate) - L->deallocate(scudo::Options{}, P); + L->deallocate(options, P); else V.push_back(P); } while (!V.empty()) { - L->deallocate(scudo::Options{}, V.back()); + L->deallocate(options, V.back()); V.pop_back(); } }