[compiler-rt] e4800fc - [ASan] Removed ASAN_SHADOW_SCALE.
Kirill Stoimenov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 7 14:11:50 PST 2021
Author: Kirill Stoimenov
Date: 2021-12-07T22:11:40Z
New Revision: e4800fc099ad204f88c432276e6488772042bffc
URL: https://github.com/llvm/llvm-project/commit/e4800fc099ad204f88c432276e6488772042bffc
DIFF: https://github.com/llvm/llvm-project/commit/e4800fc099ad204f88c432276e6488772042bffc.diff
LOG: [ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D115271
Added:
Modified:
compiler-rt/CMakeLists.txt
compiler-rt/lib/asan/asan_mapping.h
compiler-rt/lib/asan/tests/CMakeLists.txt
compiler-rt/lib/asan/tests/asan_interface_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index a8c58069ce4e9..bcab7e0061084 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -52,25 +52,6 @@ mark_as_advanced(COMPILER_RT_BUILD_ORC)
option(COMPILER_RT_BUILD_GWP_ASAN "Build GWP-ASan, and link it into SCUDO" ON)
mark_as_advanced(COMPILER_RT_BUILD_GWP_ASAN)
-set(COMPILER_RT_ASAN_SHADOW_SCALE ""
- CACHE STRING "Override the shadow scale to be used in ASan runtime")
-
-if (NOT COMPILER_RT_ASAN_SHADOW_SCALE STREQUAL "")
- # Check that the shadow scale value is valid.
- if (NOT (COMPILER_RT_ASAN_SHADOW_SCALE GREATER -1 AND
- COMPILER_RT_ASAN_SHADOW_SCALE LESS 8))
- message(FATAL_ERROR "
- Invalid ASan Shadow Scale '${COMPILER_RT_ASAN_SHADOW_SCALE}'.")
- endif()
-
- set(COMPILER_RT_ASAN_SHADOW_SCALE_LLVM_FLAG
- -mllvm -asan-mapping-scale=${COMPILER_RT_ASAN_SHADOW_SCALE})
- set(COMPILER_RT_ASAN_SHADOW_SCALE_DEFINITION
- ASAN_SHADOW_SCALE=${COMPILER_RT_ASAN_SHADOW_SCALE})
- set(COMPILER_RT_ASAN_SHADOW_SCALE_FLAG
- -D${COMPILER_RT_ASAN_SHADOW_SCALE_DEFINITION})
-endif()
-
if(FUCHSIA)
set(COMPILER_RT_HWASAN_WITH_INTERCEPTORS_DEFAULT OFF)
else()
diff --git a/compiler-rt/lib/asan/asan_mapping.h b/compiler-rt/lib/asan/asan_mapping.h
index 5e73caa61bf9f..42751390669d2 100644
--- a/compiler-rt/lib/asan/asan_mapping.h
+++ b/compiler-rt/lib/asan/asan_mapping.h
@@ -151,14 +151,9 @@
// || `[0x30000000, 0x35ffffff]` || LowShadow ||
// || `[0x00000000, 0x2fffffff]` || LowMem ||
-#if defined(ASAN_SHADOW_SCALE)
-static const u64 kDefaultShadowScale = ASAN_SHADOW_SCALE;
-#else
-static const u64 kDefaultShadowScale = 3;
-#endif
-static const u64 kDefaultShadowSentinel = ~(uptr)0;
+#define SHADOW_SCALE 3
-#define SHADOW_SCALE kDefaultShadowScale
+static const u64 kDefaultShadowSentinel = ~(uptr)0;
#if SANITIZER_FUCHSIA
# define SHADOW_OFFSET_CONST (0)
diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt
index 1a77d89469b97..cc375acf2dfbc 100644
--- a/compiler-rt/lib/asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/asan/tests/CMakeLists.txt
@@ -23,7 +23,6 @@ set(ASAN_UNITTEST_HEADERS
set(ASAN_UNITTEST_COMMON_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
- ${COMPILER_RT_ASAN_SHADOW_SCALE_LLVM_FLAG}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/asan
@@ -52,7 +51,6 @@ list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS -g)
# Use -D instead of definitions to please custom compile command.
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS
- ${COMPILER_RT_ASAN_SHADOW_SCALE_FLAG}
-DASAN_HAS_IGNORELIST=1
-DASAN_HAS_EXCEPTIONS=1
-DASAN_UAR=0
diff --git a/compiler-rt/lib/asan/tests/asan_interface_test.cpp b/compiler-rt/lib/asan/tests/asan_interface_test.cpp
index 47cbf0e8927f7..6ea04191d789b 100644
--- a/compiler-rt/lib/asan/tests/asan_interface_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_interface_test.cpp
@@ -160,7 +160,6 @@ TEST(AddressSanitizerInterface, DeathCallbackTest) {
#define BAD_ACCESS(ptr, offset) \
EXPECT_TRUE(__asan_address_is_poisoned(ptr + offset))
-#if !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3
static const char* kUseAfterPoisonErrorMessage = "use-after-poison";
TEST(AddressSanitizerInterface, SimplePoisonMemoryRegionTest) {
@@ -200,7 +199,6 @@ TEST(AddressSanitizerInterface, OverlappingPoisonMemoryRegionTest) {
BAD_ACCESS(array, 96);
free(array);
}
-#endif // !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3
TEST(AddressSanitizerInterface, PushAndPopWithPoisoningTest) {
// Vector of capacity 20
More information about the llvm-commits
mailing list