[compiler-rt] [scudo] Avoid splitting aligned allocations on Trusty (PR #69281)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 10:15:13 PST 2024
================
@@ -122,7 +122,30 @@ bool mapSecondary(const Options &Options, uptr CommitBase, uptr CommitSize,
Flags |= MAP_RESIZABLE;
Flags |= MAP_ALLOWNOMEM;
- const uptr MaxUnusedCacheBytes = MaxUnusedCachePages * getPageSizeCached();
+ const uptr PageSize = getPageSizeCached();
+ if (SCUDO_TRUSTY) {
+ /*
+ * On Trusty we need AllocPos to be usable for shared memory, which cannot
+ * cross multiple mappings. This means we need to split around AllocPos
+ * and not over it. We can only do this if the address is page-aligned.
+ */
+ const uptr TaggedSize = AllocPos - CommitBase;
+ if (useMemoryTagging<Config>(Options) && isAligned(TaggedSize, PageSize)) {
+ DCHECK_NE(TaggedSize, 0);
+ DCHECK_LT(TaggedSize, CommitSize);
----------------
ChiaHungDuan wrote:
This is redundant.
https://github.com/llvm/llvm-project/pull/69281
More information about the llvm-commits
mailing list