Skip to content

Commit

Permalink
Use SYZYASAN instead of ADDRESS_SANITIZER.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chrisha@google.com committed Mar 27, 2014
1 parent 0dcb85a commit aee2f33
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 38 deletions.
16 changes: 8 additions & 8 deletions base/allocator/allocator_shim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion base/process/process_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions base/security_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion base/test/test_timeouts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions base/tools_sanity_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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())
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2436,7 +2436,7 @@
},
},
'defines': [
'ADDRESS_SANITIZER',
'SYZYASAN',
'MEMORY_TOOL_REPLACES_ALLOCATOR',
],
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/active_tab_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/api/cookies/cookies_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chrome/common/chrome_version_info_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chrome/test/ppapi/ppapi_interactive_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 6 additions & 5 deletions chrome_elf/elf_imports_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
8 changes: 4 additions & 4 deletions content/renderer/render_frame_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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))
Expand All @@ -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.
Expand Down

0 comments on commit aee2f33

Please sign in to comment.