[compiler-rt] Fixing UB on Windows for trampoline allocations (PR #85639)
Zack Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 07:10:32 PDT 2024
https://github.com/zacklj89 updated https://github.com/llvm/llvm-project/pull/85639
>From cc378eb1228a57ae9ea11b5578f019e7b79470e3 Mon Sep 17 00:00:00 2001
From: Zachary Johnson <zajohnson at microsoft.com>
Date: Mon, 18 Mar 2024 09:46:17 -0400
Subject: [PATCH 1/2] Fixing UB on Windows for trampoline allocations
---
compiler-rt/lib/interception/interception_win.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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];
>From bf00aab809c736b5099c7f49374c4fff5a9bc404 Mon Sep 17 00:00:00 2001
From: Zachary Johnson <zajohnson at microsoft.com>
Date: Mon, 18 Mar 2024 10:10:19 -0400
Subject: [PATCH 2/2] add back UNUSED as the variable is only used in x64
---
compiler-rt/lib/interception/interception_win.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 3602b24401a3a1..a04175ba1e4b56 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;
};
-static const uptr kTrampolineScanLimitRange = 1ull << 31; // 2 gig
+UNUSED static const uptr kTrampolineScanLimitRange = 1ull << 31; // 2 gig
static const int kMaxTrampolineRegion = 1024;
static TrampolineMemoryRegion TrampolineRegions[kMaxTrampolineRegion];
More information about the llvm-commits
mailing list