forked from OSchip/llvm-project
[ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D115271
This commit is contained in:
parent
317dc31e53
commit
8421fa5d53
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
@ -204,8 +199,7 @@ static const u64 kDefaultShadowSentinel = ~(uptr)0;
|
|||
# elif SANITIZER_WINDOWS64
|
||||
# define SHADOW_OFFSET_DYNAMIC
|
||||
# else
|
||||
# define SHADOW_OFFSET_CONST \
|
||||
0x000000007FFFFFFF & (~0xFFFULL << kDefaultShadowScale)
|
||||
# define SHADOW_OFFSET_CONST 0x000000007FFFFFFF & (~0xFFFULL << SHADOW_SCALE)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue