[compiler-rt] [llvm] [ASan] Do not instrument catch block parameters on Windows (PR #159618)

David Justo via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 16:24:56 PDT 2025


================
@@ -3001,6 +3002,24 @@ void AddressSanitizer::markEscapedLocalAllocas(Function &F) {
     }
   }
 }
+// Mitigation for https://github.com/google/sanitizers/issues/749
+// We don't instrument Windows catch-block parameters to avoid
+// interfering with exception handling assumptions.
+void AddressSanitizer::markCatchParametersAsUninteresting(Function &F) {
+  for (BasicBlock &BB : F) {
+    for (Instruction &I : BB) {
+      if (auto *CatchPad = dyn_cast<CatchPadInst>(&I)) {
+        // Mark the parameters to a catch-block as uninteresting to avoid
+        // instrumenting them
+        for (Value *Operand : CatchPad->arg_operands()) {
+          if (auto *AI = dyn_cast<AllocaInst>(Operand)) {
+            ProcessedAllocas[AI] = false;
+          }
+        }
+      }
+    }
+  }
+}
----------------
davidmrdavid wrote:

I manually incorporated this.
I accidentally split it into 2 commits:
https://github.com/llvm/llvm-project/pull/159618/commits/65f17410826fad2a224127514b616a9b0bdda4ed
and
https://github.com/llvm/llvm-project/pull/159618/commits/bd511b54fe39598b6cbfff5acd92e4ab0eb3729b

https://github.com/llvm/llvm-project/pull/159618


More information about the llvm-commits mailing list