[compiler-rt] DO_NOT_MERGE (PR #66682)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 10:52:44 PDT 2023
================
@@ -446,8 +458,51 @@ class BaseReport {
const HeapChunk heap;
const Allocations allocations;
const OverflowCandidate candidate;
+
+ struct {
+ uptr addr = 0;
+ tag_t tags[512] = {};
+ tag_t short_tags[ARRAY_SIZE(tags)] = {};
+ } shadow;
};
+void BaseReport::CopyShadow() {
+ if (!MemIsApp(untagged_addr))
+ return;
+
+ shadow.addr = MemToShadow(untagged_addr) - ARRAY_SIZE(shadow.tags) / 2;
+ for (uptr i = 0; i < ARRAY_SIZE(shadow.tags); ++i) {
+ uptr tag_addr = shadow.addr + i;
+ if (!MemIsShadow(tag_addr))
+ continue;
+ shadow.tags[i] = *reinterpret_cast<tag_t *>(tag_addr);
+ uptr granule_addr = ShadowToMem(tag_addr);
+ if (1 <= shadow.tags[i] && shadow.tags[i] <= kShadowAlignment &&
+ IsAccessibleMemoryRange(granule_addr, kShadowAlignment)) {
+ shadow.short_tags[i] =
+ *reinterpret_cast<tag_t *>(granule_addr + kShadowAlignment - 1);
+ }
+ }
+}
+
+tag_t BaseReport::GetTagCopy(uptr addr) const {
----------------
fmayer wrote:
Why do we expect for those to be called out of range? Should the checks be assert instead? `0` tag is not the same as "we don't know" really.
https://github.com/llvm/llvm-project/pull/66682
More information about the llvm-commits
mailing list