[PATCH] D126269: [ASan] Skip pointer comparison and subtraction inserted by another instrumentation.
Mingjie Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 21:50:51 PDT 2022
Enna1 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Enna1 edited the summary of this revision.
Enna1 added reviewers: vitalybuka, dvyukov.
Enna1 added a subscriber: MTC.
Enna1 published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When using ASan/pointer-compare together with UBSan/pointer-overflow under optimization level O1 <https://reviews.llvm.org/owners/package/1/>, then there will be a false positive in ASan. see https://github.com/google/sanitizers/issues/1508
This patch and D126270 <https://reviews.llvm.org/D126270> together will fix the false positive.
This patch: [ASan] Skip pointer comparison and subtraction instructions with !nosanitize metadata.
D126270 <https://reviews.llvm.org/D126270>: [InstCombine] Preserve !nosanitize for newly created instructions if old instructions have !nosanitize metadata.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126269
Files:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1397,6 +1397,8 @@
// false negatives. The proper implementation requires cooperation with
// the frontend.
static bool isInterestingPointerComparison(Instruction *I) {
+ if (I->hasMetadata("nosanitize"))
+ return false;
if (ICmpInst *Cmp = dyn_cast<ICmpInst>(I)) {
if (!Cmp->isRelational())
return false;
@@ -1411,6 +1413,8 @@
// false negatives. The proper implementation requires cooperation with
// the frontend.
static bool isInterestingPointerSubtraction(Instruction *I) {
+ if (I->hasMetadata("nosanitize"))
+ return false;
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
if (BO->getOpcode() != Instruction::Sub)
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126269.431578.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220524/942bb0e0/attachment.bin>
More information about the llvm-commits
mailing list