-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Fixing UB on Windows for trampoline allocations #85639
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 Author: Zack Johnson (zacklj89) ChangesThis is actually used on Windows, so removing Full diff: https://github.com/llvm/llvm-project/pull/85639.diff 1 Files Affected:
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 1829358705fe82..3602b24401a3a1 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -339,7 +339,7 @@ struct TrampolineMemoryRegion {
uptr max_size;
};
-UNUSED static const uptr kTrampolineScanLimitRange = 1 << 31; // 2 gig
+static const uptr kTrampolineScanLimitRange = 1ull << 31; // 2 gig
static const int kMaxTrampolineRegion = 1024;
static TrampolineMemoryRegion TrampolineRegions[kMaxTrampolineRegion];
|
No, it's not used in i386 mode. It's used in some modes, but not all - therefore it is marked as unused to silence warnings in those build configuration. See 979c38c which introduced the attribute here. |
Then shouldn't it be guarded by |
That's certainly an option too. IIRC I proposed that originally, but avoiding ifdefs and marking it unused was suggested here: https://reviews.llvm.org/D91852#inline-861716 |
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.
LGTM, thanks!
(At this point, it'd be good to update the commit description, which ends up as the commit message, to not refer to removing UNUSED
any longer. Or whoever does the merge can do that fixup of the commit message before finishing the merge.)
…5639) Fixing the type of the constant to avoid undefined behavior with respect to overflow.
Fixing the type of the constant to avoid undefined behavior with respect to overflow.