Commit aee2f33c authored by chrisha@google.com's avatar chrisha@google.com

Use SYZYASAN instead of ADDRESS_SANITIZER.

We've seen different failure related to the fact that we use the same flag without providing the same API and functionality.

BUG=
TBR=jamesr

Review URL: https://codereview.chromium.org/212643015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259855 0039d316-1c4b-4281-b951-d872f2087c98
parent 0dcb85a5
...@@ -41,8 +41,8 @@ typedef enum { ...@@ -41,8 +41,8 @@ typedef enum {
// See SetupSubprocessAllocator() to specify a default secondary (subprocess) // See SetupSubprocessAllocator() to specify a default secondary (subprocess)
// allocator. // allocator.
// TODO(jar): Switch to using TCMALLOC for the renderer as well. // TODO(jar): Switch to using TCMALLOC for the renderer as well.
#if (defined(ADDRESS_SANITIZER) && defined(OS_WIN)) #if defined(SYZYASAN)
// The Windows implementation of Asan requires the use of "WINHEAP". // SyzyASan requires the use of "WINHEAP".
static Allocator allocator = WINHEAP; static Allocator allocator = WINHEAP;
#else #else
static Allocator allocator = TCMALLOC; static Allocator allocator = TCMALLOC;
...@@ -228,9 +228,9 @@ static void release_free_memory_thunk() { ...@@ -228,9 +228,9 @@ static void release_free_memory_thunk() {
// The CRT heap initialization stub. // The CRT heap initialization stub.
extern "C" int _heap_init() { extern "C" int _heap_init() {
// Don't use the environment variable if ADDRESS_SANITIZER is defined on // Don't use the environment variable if SYZYASAN is defined, as the
// Windows, as the implementation requires Winheap to be the allocator. // implementation requires Winheap to be the allocator.
#if !(defined(ADDRESS_SANITIZER) && defined(OS_WIN)) #if !defined(SYZYASAN)
const char* environment_value = GetenvBeforeMain(primary_name); const char* environment_value = GetenvBeforeMain(primary_name);
if (environment_value) { if (environment_value) {
if (!stricmp(environment_value, "winheap")) if (!stricmp(environment_value, "winheap"))
...@@ -356,9 +356,9 @@ void SetupSubprocessAllocator() { ...@@ -356,9 +356,9 @@ void SetupSubprocessAllocator() {
buffer[sizeof(buffer) - 1] = '\0'; buffer[sizeof(buffer) - 1] = '\0';
if (secondary_length || !primary_length) { if (secondary_length || !primary_length) {
// Don't use the environment variable if ADDRESS_SANITIZER is defined on // Don't use the environment variable if SYZYASAN is defined, as the
// Windows, as the implementation require Winheap to be the allocator. // implementation require Winheap to be the allocator.
#if !(defined(ADDRESS_SANITIZER) && defined(OS_WIN)) #if !defined(SYZYASAN)
const char* secondary_value = secondary_length ? buffer : "TCMALLOC"; const char* secondary_value = secondary_length ? buffer : "TCMALLOC";
// Force renderer (or other subprocesses) to use secondary_value. // Force renderer (or other subprocesses) to use secondary_value.
#else #else
......
...@@ -235,7 +235,8 @@ MULTIPROCESS_TEST_MAIN(CrashingChildProcess) { ...@@ -235,7 +235,8 @@ MULTIPROCESS_TEST_MAIN(CrashingChildProcess) {
// This test intentionally crashes, so we don't need to run it under // This test intentionally crashes, so we don't need to run it under
// AddressSanitizer. // AddressSanitizer.
// TODO(jschuh): crbug.com/175753 Fix this in Win64 bots. // TODO(jschuh): crbug.com/175753 Fix this in Win64 bots.
#if defined(ADDRESS_SANITIZER) || (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) #if defined(ADDRESS_SANITIZER) || \
(defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || defined(SYZYASAN)
#define MAYBE_GetTerminationStatusCrash DISABLED_GetTerminationStatusCrash #define MAYBE_GetTerminationStatusCrash DISABLED_GetTerminationStatusCrash
#else #else
#define MAYBE_GetTerminationStatusCrash GetTerminationStatusCrash #define MAYBE_GetTerminationStatusCrash GetTerminationStatusCrash
......
...@@ -43,11 +43,11 @@ Type HideValueFromCompiler(volatile Type value) { ...@@ -43,11 +43,11 @@ Type HideValueFromCompiler(volatile Type value) {
} }
// - NO_TCMALLOC (should be defined if compiled with use_allocator!="tcmalloc") // - NO_TCMALLOC (should be defined if compiled with use_allocator!="tcmalloc")
// - ADDRESS_SANITIZER because it has its own memory allocator // - ADDRESS_SANITIZER and SYZYASAN because they have their own memory allocator
// - IOS does not use tcmalloc // - IOS does not use tcmalloc
// - OS_MACOSX does not use tcmalloc // - OS_MACOSX does not use tcmalloc
#if !defined(NO_TCMALLOC) && !defined(ADDRESS_SANITIZER) && \ #if !defined(NO_TCMALLOC) && !defined(ADDRESS_SANITIZER) && \
!defined(OS_IOS) && !defined(OS_MACOSX) !defined(OS_IOS) && !defined(OS_MACOSX) && !defined(SYZYASAN)
#define TCMALLOC_TEST(function) function #define TCMALLOC_TEST(function) function
#else #else
#define TCMALLOC_TEST(function) DISABLED_##function #define TCMALLOC_TEST(function) DISABLED_##function
......
...@@ -16,7 +16,7 @@ namespace { ...@@ -16,7 +16,7 @@ namespace {
// ASan and TSan instrument each memory access. This may slow the execution // ASan and TSan instrument each memory access. This may slow the execution
// down significantly. // down significantly.
#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(SYZYASAN)
static const int kTimeoutMultiplier = 2; static const int kTimeoutMultiplier = 2;
#else #else
static const int kTimeoutMultiplier = 1; static const int kTimeoutMultiplier = 1;
......
...@@ -20,7 +20,7 @@ const base::subtle::Atomic32 kMagicValue = 42; ...@@ -20,7 +20,7 @@ const base::subtle::Atomic32 kMagicValue = 42;
// Helper for memory accesses that can potentially corrupt memory or cause a // Helper for memory accesses that can potentially corrupt memory or cause a
// crash during a native run. // crash during a native run.
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
#if defined(OS_IOS) #if defined(OS_IOS)
// EXPECT_DEATH is not supported on IOS. // EXPECT_DEATH is not supported on IOS.
#define HARMFUL_ACCESS(action,error_regexp) do { action; } while (0) #define HARMFUL_ACCESS(action,error_regexp) do { action; } while (0)
...@@ -113,7 +113,7 @@ TEST(ToolsSanityTest, MemoryLeak) { ...@@ -113,7 +113,7 @@ TEST(ToolsSanityTest, MemoryLeak) {
// tests should be put back under the (defined(OS_IOS) || defined(OS_WIN)) // tests should be put back under the (defined(OS_IOS) || defined(OS_WIN))
// clause above. // clause above.
// See also http://crbug.com/172614. // See also http://crbug.com/172614.
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
#define MAYBE_SingleElementDeletedWithBraces \ #define MAYBE_SingleElementDeletedWithBraces \
DISABLED_SingleElementDeletedWithBraces DISABLED_SingleElementDeletedWithBraces
#define MAYBE_ArrayDeletedWithoutBraces DISABLED_ArrayDeletedWithoutBraces #define MAYBE_ArrayDeletedWithoutBraces DISABLED_ArrayDeletedWithoutBraces
...@@ -135,7 +135,7 @@ TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) { ...@@ -135,7 +135,7 @@ TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) {
} }
TEST(ToolsSanityTest, MAYBE_ArrayDeletedWithoutBraces) { TEST(ToolsSanityTest, MAYBE_ArrayDeletedWithoutBraces) {
#if !defined(ADDRESS_SANITIZER) #if !defined(ADDRESS_SANITIZER) && !defined(SYZYASAN)
// This test may corrupt memory if not run under Valgrind or compiled with // This test may corrupt memory if not run under Valgrind or compiled with
// AddressSanitizer. // AddressSanitizer.
if (!RunningOnValgrind()) if (!RunningOnValgrind())
...@@ -161,7 +161,7 @@ TEST(ToolsSanityTest, MAYBE_SingleElementDeletedWithBraces) { ...@@ -161,7 +161,7 @@ TEST(ToolsSanityTest, MAYBE_SingleElementDeletedWithBraces) {
delete [] foo; delete [] foo;
} }
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
TEST(ToolsSanityTest, DISABLED_AddressSanitizerNullDerefCrashTest) { TEST(ToolsSanityTest, DISABLED_AddressSanitizerNullDerefCrashTest) {
// Intentionally crash to make sure AddressSanitizer is running. // Intentionally crash to make sure AddressSanitizer is running.
// This test should not be ran on bots. // This test should not be ran on bots.
......
...@@ -2436,7 +2436,7 @@ ...@@ -2436,7 +2436,7 @@
}, },
}, },
'defines': [ 'defines': [
'ADDRESS_SANITIZER', 'SYZYASAN',
'MEMORY_TOOL_REPLACES_ALLOCATOR', 'MEMORY_TOOL_REPLACES_ALLOCATOR',
], ],
}], }],
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "chrome/test/base/test_switches.h" #include "chrome/test/base/test_switches.h"
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
// Times out on win asan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026
#if defined(OS_WIN) && defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
#define MAYBE_GetAlertsForTab DISABLED_GetAlertsForTab #define MAYBE_GetAlertsForTab DISABLED_GetAlertsForTab
#else #else
#define MAYBE_GetAlertsForTab GetAlertsForTab #define MAYBE_GetAlertsForTab GetAlertsForTab
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
namespace extensions { namespace extensions {
namespace { namespace {
// Times out on win asan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026
#if defined(OS_WIN) && defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
#define MAYBE_ActiveTab DISABLED_ActiveTab #define MAYBE_ActiveTab DISABLED_ActiveTab
#else #else
#define MAYBE_ActiveTab ActiveTab #define MAYBE_ActiveTab ActiveTab
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/user_prefs/user_prefs.h" #include "components/user_prefs/user_prefs.h"
// Times out on win asan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026
#if defined(OS_WIN) && defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
#define MAYBE_BookmarkManager DISABLED_BookmarkManager #define MAYBE_BookmarkManager DISABLED_BookmarkManager
#else #else
#define MAYBE_BookmarkManager BookmarkManager #define MAYBE_BookmarkManager BookmarkManager
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
namespace extensions { namespace extensions {
// Times out on win asan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026
#if defined(OS_WIN) && defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
#define MAYBE_ContextMenus DISABLED_ContextMenus #define MAYBE_ContextMenus DISABLED_ContextMenus
#else #else
#define MAYBE_ContextMenus ContextMenus #define MAYBE_ContextMenus ContextMenus
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
namespace extensions { namespace extensions {
// Times out on win asan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026
#if defined(OS_WIN) && defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
#define MAYBE_Cookies DISABLED_Cookies #define MAYBE_Cookies DISABLED_Cookies
#else #else
#define MAYBE_Cookies Cookies #define MAYBE_Cookies Cookies
......
...@@ -27,7 +27,7 @@ std::string VersionInfo::GetVersionStringModifier() { ...@@ -27,7 +27,7 @@ std::string VersionInfo::GetVersionStringModifier() {
GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install, GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install,
&channel); &channel);
} }
#if defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
if (base::debug::IsBinaryInstrumented()) if (base::debug::IsBinaryInstrumented())
channel += L" SyzyASan"; channel += L" SyzyASan";
#endif #endif
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
// Disable tests under ASAN. http://crbug.com/104832. // Disable tests under ASAN. http://crbug.com/104832.
// This is a bit heavy handed, but the majority of these tests fail under ASAN. // This is a bit heavy handed, but the majority of these tests fail under ASAN.
// See bug for history. // See bug for history.
#if !defined(ADDRESS_SANITIZER) #if !defined(ADDRESS_SANITIZER) && !defined(SYZYASAN)
// Disabled due to timeouts: http://crbug.com/136548 // Disabled due to timeouts: http://crbug.com/136548
IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F(
......
...@@ -61,12 +61,13 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) { ...@@ -61,12 +61,13 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) {
std::vector<std::string>::iterator it(elf_imports.begin()); std::vector<std::string>::iterator it(elf_imports.begin());
static const char* const kValidFilePatterns[] = { static const char* const kValidFilePatterns[] = {
"KERNEL32.dll", "KERNEL32.dll",
"MSVC*", "MSVC*",
#if defined(ADDRESS_SANITIZER) #if defined(SYZYASAN)
"syzyasan_rtl.dll", "syzyasan_rtl.dll",
#endif #endif
"ADVAPI32.dll"}; "ADVAPI32.dll"
};
// Make sure all of ELF's imports are in the valid imports list. // Make sure all of ELF's imports are in the valid imports list.
for (; it != elf_imports.end(); it++) { for (; it != elf_imports.end(); it++) {
......
...@@ -176,7 +176,7 @@ NOINLINE static void CrashIntentionally() { ...@@ -176,7 +176,7 @@ NOINLINE static void CrashIntentionally() {
*zero = 0; *zero = 0;
} }
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
NOINLINE static void MaybeTriggerAsanError(const GURL& url) { NOINLINE static void MaybeTriggerAsanError(const GURL& url) {
// NOTE(rogerm): We intentionally perform an invalid heap access here in // NOTE(rogerm): We intentionally perform an invalid heap access here in
// order to trigger an Address Sanitizer (ASAN) error report. // order to trigger an Address Sanitizer (ASAN) error report.
...@@ -208,7 +208,7 @@ NOINLINE static void MaybeTriggerAsanError(const GURL& url) { ...@@ -208,7 +208,7 @@ NOINLINE static void MaybeTriggerAsanError(const GURL& url) {
// Make sure the assignments to the dummy value aren't optimized away. // Make sure the assignments to the dummy value aren't optimized away.
base::debug::Alias(&dummy); base::debug::Alias(&dummy);
} }
#endif // ADDRESS_SANITIZER #endif // ADDRESS_SANITIZER || SYZYASAN
static void MaybeHandleDebugURL(const GURL& url) { static void MaybeHandleDebugURL(const GURL& url) {
if (!url.SchemeIs(kChromeUIScheme)) if (!url.SchemeIs(kChromeUIScheme))
...@@ -225,9 +225,9 @@ static void MaybeHandleDebugURL(const GURL& url) { ...@@ -225,9 +225,9 @@ static void MaybeHandleDebugURL(const GURL& url) {
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20));
} }
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
MaybeTriggerAsanError(url); MaybeTriggerAsanError(url);
#endif // ADDRESS_SANITIZER #endif // ADDRESS_SANITIZER || SYZYASAN
} }
// Returns false unless this is a top-level navigation. // Returns false unless this is a top-level navigation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment