Skip to content

Commit 82a7832

Browse files
authored
[llvm][AddressSanitizer][BPF] add default shadow mapping offset for BPF target (#167768)
The AddressSanitizer transform does not have a default offset registered for the shadow map. Set the default shadow map offset for BPF be dynamically set by the KASAN implementation.
1 parent a1e47ce commit 82a7832

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
508508
bool IsAMDGPU = TargetTriple.isAMDGPU();
509509
bool IsHaiku = TargetTriple.isOSHaiku();
510510
bool IsWasm = TargetTriple.isWasm();
511+
bool IsBPF = TargetTriple.isBPF();
511512

512513
ShadowMapping Mapping;
513514

@@ -584,6 +585,8 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
584585
else if (IsHaiku && IsX86_64)
585586
Mapping.Offset = (kSmallX86_64ShadowOffsetBase &
586587
(kSmallX86_64ShadowOffsetAlignMask << Mapping.Scale));
588+
else if (IsBPF)
589+
Mapping.Offset = kDynamicShadowSentinel;
587590
else
588591
Mapping.Offset = kDefaultShadowOffset64;
589592
}

0 commit comments

Comments
 (0)