[PATCH] D126270: [InstCombine] Preserve !nosanitize for newly created instructions.
Mingjie Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 30 02:24:42 PDT 2022
Enna1 added a comment.
I came up a workaround, but it may not elegant enough i think.
In AddressSanitizer.cpp `isInterestingPointerComparison()`, we add a check if the two following conditions satisfied:
- the ICmpInst is used as a branchinst predicate
- the branchinst has a successor containing callback inserted by UBSan(e.g. __ubsan_handle_pointer_overflow)
If so, ASan will not take this ICmpInst as an interesting pointer compairson, as will not have a false positive on this.
define dso_local i32 @main() local_unnamed_addr #0 !dbg !9 {
%1 = alloca [10 x i8], align 1
call void @llvm.dbg.declare(metadata [10 x i8]* %1, metadata !14, metadata !DIExpression()), !dbg !19
%2 = ptrtoint [10 x i8]* %1 to i64, !dbg !20, !nosanitize !13
%.not = icmp ugt [10 x i8]* %1, inttoptr (i64 -5 to [10 x i8]*), !dbg !20
br i1 %.not, label %3, label %5, !dbg !20, !prof !21, !nosanitize !13
3: ; preds = %0
%4 = add i64 %2, 4, !dbg !20, !nosanitize !13
call void @__ubsan_handle_pointer_overflow(i8* bitcast ({ { [7 x i8]*, i32, i32 } }* @0 to i8*), i64 %2, i64 %4) #3, !dbg !20, !nosanitize !13
br label %5, !dbg !20, !nosanitize !13
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126270/new/
https://reviews.llvm.org/D126270
More information about the llvm-commits
mailing list