diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -721,6 +721,7 @@ void visitBitCastInst(BitCastInst &BCI); void visitCastInst(CastInst &CI); void visitCmpInst(CmpInst &CI); + void visitLandingPadInst(LandingPadInst &LPI); void visitGetElementPtrInst(GetElementPtrInst &GEPI); void visitLoadInst(LoadInst &LI); void visitStoreInst(StoreInst &SI); @@ -2561,6 +2562,16 @@ } } +void DFSanVisitor::visitLandingPadInst(LandingPadInst &LPI) { + // We do not need to track data through LandingPadInst. + // If a value is thrown, this value will be stored in a memory location + // provided by the API (will have a shadow), not via the LandingPadInst. + // The second element in the pair result of the LandingPadInst is a + // register value, but it is for a type ID and should never be tainted. + DFSF.setShadow(&LPI, DFSF.DFS.getZeroShadow(&LPI)); + DFSF.setOrigin(&LPI, DFSF.DFS.ZeroOrigin); +} + void DFSanVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) { if (ClCombineOffsetLabelsOnGEP) { visitInstOperands(GEPI); diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/call.ll b/llvm/test/Instrumentation/DataFlowSanitizer/call.ll --- a/llvm/test/Instrumentation/DataFlowSanitizer/call.ll +++ b/llvm/test/Instrumentation/DataFlowSanitizer/call.ll @@ -48,7 +48,7 @@ catch i8* null %1 = extractvalue { i8*, i32 } %0, 0 - ; CHECK: store {{.*}} @__dfsan_arg_tls + ; CHECK: store i8 0,{{.*}} @__dfsan_arg_tls ; CHECK: call {{.*}} @"dfs$__cxa_begin_catch" ; CHECK: load {{.*}} @__dfsan_retval_tls %2 = tail call i8* @__cxa_begin_catch(i8* %1)