[PATCH] D109233: [hwasan] Respect returns attribute when tracking values.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 11:16:11 PDT 2021


vitalybuka added inline comments.


================
Comment at: llvm/lib/Analysis/StackSafetyAnalysis.cpp:397
         // alloca.
         US.addRange(I, UnknownRange);
         break;
----------------
Isn't this in the call will make it unsafe anyway?


================
Comment at: llvm/lib/Analysis/StackSafetyAnalysis.cpp:416
         const auto &CB = cast<CallBase>(*I);
+        if (CB.getReturnedArgOperand() == V) {
+          if (Visited.insert(I).second)
----------------
does SCEV can look through such calls?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4536
       AddWork(GEP->getPointerOperand());
+    } else if (CallBase *CB = dyn_cast<CallBase>(V)) {
+      Value *Returned = CB->getReturnedArgOperand();
----------------
There is "TEST_P(FindAllocaForValueTest, findAllocaForValue*" tests which need to be extended for this test.
Improving findAllocaForValue is a patch by itself and may affect other components, so I ask you to not mix this with StackSafetyAnalysis (if possible)


================
Comment at: llvm/test/Instrumentation/HWAddressSanitizer/stack-safety-analysis.ll:159
+; Check whether we see through the returns attribute of functions.
+define i32 @test_retptr(i32* %a) sanitize_hwaddress {
+entry:
----------------
Having that retptr has no body here, SAFETY should make it "call to retptr" unsafe anyway


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109233



More information about the llvm-commits mailing list