-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[dfsan] Fix getShadowAddress computation #162864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-compiler-rt-sanitizer @llvm/pr-subscribers-llvm-transforms Author: None (anoopkg6) ChangesFix getShadowAddress computation by adding ShadowBase if it is not zero. Full diff: https://github.com/llvm/llvm-project/pull/162864.diff 2 Files Affected:
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index ca45d7bd2af7f..05aa7e153f362 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -36,7 +36,7 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${LOONGARCH64})
set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
-set(ALL_RTSAN_SUPPORTED_ARCH ${X86_64} ${ARM64})
+set(ALL_RTSAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${S390X})
if(ANDROID)
set(OS_NAME "Android")
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 5ba2167859490..cc53ec2c0f2f3 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1957,8 +1957,12 @@ Value *DataFlowSanitizer::getShadowAddress(Value *Addr,
Value *DataFlowSanitizer::getShadowAddress(Value *Addr,
BasicBlock::iterator Pos) {
IRBuilder<> IRB(Pos->getParent(), Pos);
- Value *ShadowOffset = getShadowOffset(Addr, IRB);
- return getShadowAddress(Addr, Pos, ShadowOffset);
+ Value *ShadowAddr = getShadowOffset(Addr, IRB);
+ uint64_t ShadowBase = MapParams->ShadowBase;
+ if (ShadowBase != 0)
+ ShadowAddr =
+ IRB.CreateAdd(ShadowAddr, ConstantInt::get(IntptrTy, ShadowBase));
+ return getShadowAddress(Addr, Pos, ShadowAddr);
}
Value *DFSanFunction::combineShadowsThenConvert(Type *T, Value *V1, Value *V2,
|
| set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32}) | ||
| set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64}) | ||
| set(ALL_RTSAN_SUPPORTED_ARCH ${X86_64} ${ARM64}) | ||
| set(ALL_RTSAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${S390X}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change would belong better in the S390X-specific pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Also, it's for RTSan, not DFSan?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, some unrelated changes got pull into this pr. Updated push should have only one file changes.
|
Please add "[dfsan]" to the title |
bc4e2ce to
0f31442
Compare
|
[dfsan] has been added to the tile. This pr has changes related to getShadowAddress in DFSan only. RTSAN change has been removed. |
thurstond
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Is it ready to merge?
|
Yes, It is ready to merge along with #162881<#162881>. Once these two prs are merged, I will rebase SystemZ pr on top.
…________________________________
From: Thurston Dang ***@***.***>
Sent: Wednesday, October 29, 2025 3:59 PM
To: llvm/llvm-project ***@***.***>
Cc: Anoop Kumar ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [llvm/llvm-project] [dfsan] Fix getShadowAddress computation (PR #162864)
@ thurstond approved this pull request. Thanks! Is it ready to merge? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: <llvm/llvm-project/pull/162864/review/3396216461@ github. com>
@thurstond approved this pull request.
Thanks! Is it ready to merge?
—
Reply to this email directly, view it on GitHub<#162864 (review) >, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BM5K4GT3R2SS432DEH2BN4332ETCPAVCNFSM6AAAAACI3ETHUOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGOJWGIYTMNBWGE >.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
Thanks.
…________________________________
From: Thurston Dang ***@***.***>
Sent: Wednesday, October 29, 2025 4:39 PM
To: llvm/llvm-project ***@***.***>
Cc: Anoop Kumar ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [llvm/llvm-project] [dfsan] Fix getShadowAddress computation (PR #162864)
Merged #162864 into main. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: <llvm/llvm-project/pull/162864/issue_event/20592235782@ github. com>
Merged #162864<#162864 > into main.
—
Reply to this email directly, view it on GitHub<#162864 (comment) >, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BM5K4GS2HFDMYY4X454YTBD32EXXZAVCNFSM6AAAAACI3ETHUOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRQGU4TEMRTGU3TQMQ >.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Fix getShadowAddress computation by adding ShadowBase if it is not zero. Co-authored-by: anoopkg6 <[email protected]>
Fix getShadowAddress computation by adding ShadowBase if it is not zero. Co-authored-by: anoopkg6 <[email protected]>
Fix getShadowAddress computation by adding ShadowBase if it is not zero.