[compiler-rt] [scudo] Fix the logic of MaxAllowedFragmentedPages (PR #107927)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 15:27:58 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (ChiaHungDuan)

<details>
<summary>Changes</summary>

MTE doesn't support MaxReleasedCachePages which may break the assumption that only the first 4 pages will have memory tagged.

---
Full diff: https://github.com/llvm/llvm-project/pull/107927.diff


1 Files Affected:

- (modified) compiler-rt/lib/scudo/standalone/secondary.h (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index 1a232b9b9fb2d7..7d85832d7fe714 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -725,7 +725,7 @@ MapAllocator<Config>::tryAllocateFromCache(const Options &Options, uptr Size,
   uptr EntryHeaderPos;
   uptr MaxAllowedFragmentedPages = MaxUnreleasedCachePages;
 
-  if (UNLIKELY(useMemoryTagging<Config>(Options)))
+  if (LIKELY(!useMemoryTagging<Config>(Options)))
     MaxAllowedFragmentedPages += CachedBlock::MaxReleasedCachePages;
 
   Entry = Cache.retrieve(MaxAllowedFragmentedPages, Size, Alignment,

``````````

</details>


https://github.com/llvm/llvm-project/pull/107927


More information about the llvm-commits mailing list