Lines Matching +full:use +full:- +full:guard +full:- +full:pages

1 //===-- secondary.h ---------------------------------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
27 // Blocks allocated will be preceded and followed by a guard page, and hold
28 // their own header that is not checksummed: the guard pages and the Combined
58 return reinterpret_cast<Header *>(addHeaderTag<Config>(Ptr)) - 1;
68 // Note that the `H->MapMap` is stored on the pages managed by itself. Take
70 // won't touch inaccessible pages.
71 MemMapT MemMap = H->MemMap;
113 Str->append("Secondary Cache Disabled\n");
130 * and not over it. We can only do this if the address is page-aligned.
132 const uptr TaggedSize = AllocPos - CommitBase;
137 MemMap.remap(AllocPos, CommitSize - TaggedSize, "scudo:secondary",
150 return MemMap.remap(CommitBase, UntaggedPos - CommitBase, "scudo:secondary",
152 MemMap.remap(UntaggedPos, CommitBase + CommitSize - UntaggedPos,
161 // Template specialization to avoid producing zero-length array
183 Str->append(
187 atomic_load_relaxed(&MaxEntrySize), Interval >= 0 ? Interval : -1);
188 Str->append("Stats: CacheRetrievalStats: SuccessRate: %u/%u "
194 Str->append("StartBlockAddress: 0x%zx, EndBlockAddress: 0x%zx, "
219 if (!canCache(H->CommitSize))
228 Entry.CommitBase = H->CommitBase;
229 Entry.CommitSize = H->CommitSize;
231 Entry.MemMap = H->MemMap;
252 if (useMemoryTagging<Config>(Options) && QuarantinePos == -1U) {
293 releaseOlderThan(Time - static_cast<u64>(Interval) * 1000000);
321 roundDown(CommitBase + CommitSize - Size, Alignment);
322 const uptr HeaderPos = AllocPos - HeadersSize;
330 const uptr Diff = HeaderPos - CommitBase;
331 // immediately use a cached block if it's size is close enough to the
334 (CommitBase + CommitSize - HeaderPos) / FragmentedBytesDivisor;
351 EntriesCount--;
374 (*H)->CommitBase = Entry.CommitBase;
375 (*H)->CommitSize = Entry.CommitSize;
376 (*H)->MemMap = Entry.MemMap;
427 QuarantinePos = -1U;
500 s32 ReleaseToOsInterval = -1) NO_THREAD_SAFETY_ANALYSIS {
506 S->link(&Stats);
517 return B->CommitBase + B->CommitSize;
521 return getBlockEnd(Ptr) - reinterpret_cast<uptr>(Ptr);
578 // (greater than a page) alignments on 32-bit platforms.
584 // the committed memory will amount to something close to Size - AlignmentHint
604 const uptr BlockEnd = H->CommitBase + H->CommitSize;
614 BlockEnd - PtrInt);
618 AllocatedBytes += H->CommitSize;
619 FragmentedBytes += H->MemMap.getCapacity() - H->CommitSize;
621 Stats.add(StatAllocated, H->CommitSize);
622 Stats.add(StatMapped, H->MemMap.getCapacity());
631 RoundedSize += Alignment - PageSize;
653 CommitBase = roundUp(MapBase + PageSize + 1, Alignment) - PageSize;
654 const uptr NewMapBase = CommitBase - PageSize;
656 // We only trim the extra memory on 32-bit platforms: 64-bit platforms
659 MemMap.unmap(MapBase, NewMapBase - MapBase);
666 MemMap.unmap(NewMapEnd, MapEnd - NewMapEnd);
671 const uptr CommitSize = MapEnd - PageSize - CommitBase;
672 const uptr AllocPos = roundDown(CommitBase + CommitSize - Size, Alignment);
678 const uptr HeaderPos = AllocPos - getHeadersSize();
684 H->CommitBase = CommitBase;
685 H->CommitSize = CommitSize;
686 H->MemMap = MemMap;
693 FragmentedBytes += H->MemMap.getCapacity() - CommitSize;
698 Stats.add(StatMapped, H->MemMap.getCapacity());
707 const uptr CommitSize = H->CommitSize;
712 FragmentedBytes -= H->MemMap.getCapacity() - CommitSize;
715 Stats.sub(StatMapped, H->MemMap.getCapacity());
723 Str->append("Stats: MapAllocator: allocated %u times (%zuK), freed %u times "
726 FreedBytes >> 10, NumberOfAllocs - NumberOfFrees,
727 (AllocatedBytes - FreedBytes) >> 10, LargestSize >> 20,