[llvm] [hwasan] Optimize outlined memaccess for fixed shadow on Aarch64 (PR #88544)
Thurston Dang via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 11:05:38 PDT 2024
================
@@ -625,14 +638,32 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) {
.addImm(4)
.addImm(55),
*STI);
- OutStreamer->emitInstruction(
- MCInstBuilder(AArch64::LDRBBroX)
- .addReg(AArch64::W16)
- .addReg(IsShort ? AArch64::X20 : AArch64::X9)
- .addReg(AArch64::X16)
- .addImm(0)
- .addImm(0),
- *STI);
+
+ if (HwasanFixedShadowBase != (unsigned long long)-1) {
+ assert(IsShort);
----------------
thurstond wrote:
Yep. Non-short is only used by Android 10 and earlier; implementing fixed shadow optimization for that is left as an exercise for the reader.
```
// Older versions of Android do not have the required runtime support for
// short granules, global or personality function instrumentation. On other
// platforms we currently require using the latest version of the runtime.
bool NewRuntime =
!TargetTriple.isAndroid() || !TargetTriple.isAndroidVersionLT(30);
UseShortGranules = optOr(ClUseShortGranules, NewRuntime);
```
(llvm-project/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp)
https://github.com/llvm/llvm-project/pull/88544
More information about the llvm-commits
mailing list