[PATCH] D112098: [ASan] Added stack safety support in address sanitizer.

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 19 18:13:32 PDT 2021


vitalybuka added inline comments.


================
Comment at: clang/include/clang/Basic/CodeGenOptions.def:227
 CODEGENOPT(SanitizeAddressUseOdrIndicator, 1, 0) ///< Enable ODR indicator globals
+CODEGENOPT(SanitizeAddressUseStackSafety, 1, 0) ///< Use stack safety result.
 CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in
----------------
We should avoid this flag.
this is internal optimization. if it works we need to make it on 
for experiments -mllvm is enough.

Also clang stuff better to extract to a separate patch.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:812
   bool runOnFunction(Function &F) override {
+    if (ClUseStackSafety) {
+      report_fatal_error("Stack safety analysis is not supported "
----------------
functionality of the pass should be the same, so I don't see why this is the fatal error. so just ignore it?

btw, why don't you want to support it?


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1265
 GlobalsMetadata ASanGlobalsMetadataAnalysis::run(Module &M,
                                                  ModuleAnalysisManager &AM) {
   return GlobalsMetadata(M);
----------------
You can make this module pass to calculate StackSafetyGlobalAnalysis and use cached one below.
This way we will avoid exposure of this logic to PM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112098/new/

https://reviews.llvm.org/D112098



More information about the cfe-commits mailing list