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