Bug 898230 - Disable alloc-dealloc checking under AddressSanitizer. r=glandium

This commit is contained in:
Christian Holler 2013-07-29 02:44:00 +02:00
parent 9d7b42cb9c
commit 2ff908525e
3 changed files with 28 additions and 11 deletions

View File

@ -996,14 +996,3 @@ js::TriggerOperationCallbackForAsmJSCode(JSRuntime *rt)
MOZ_CRASH();
#endif
}
#ifdef MOZ_ASAN
// When running with asm.js under AddressSanitizer, we need to explicitely
// tell AddressSanitizer to allow custom signal handlers because it will
// otherwise trigger ASan's SIGSEGV handler for the internal SIGSEGVs that
// asm.js would otherwise handle.
extern "C" MOZ_ASAN_BLACKLIST
const char* __asan_default_options() {
return "allow_user_segv_handler=1";
}
#endif

View File

@ -0,0 +1,24 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Attributes.h"
// When running with AddressSanitizer, we need to explicitely set some
// options specific to our codebase to prevent errors during runtime.
//
// Currently, these are:
//
// allow_user_segv_handler=1 - Tell ASan to allow our code to use its
// own SIGSEGV handlers. This is required by ASM.js internally.
//
// alloc_dealloc_mismatch=0 - Disable alloc-dealloc mismatch checking
// in ASan. This is required because we define our own new/delete
// operators that are backed by malloc/free. If one of them gets inlined
// while the other doesn't, ASan will report false positives.
//
extern "C" MOZ_ASAN_BLACKLIST
const char* __asan_default_options() {
return "allow_user_segv_handler=1:alloc_dealloc_mismatch=0";
}

View File

@ -45,6 +45,10 @@ if CONFIG['CPU_ARCH'] == 'arm':
'arm.cpp',
]
if CONFIG['MOZ_ASAN']:
CPP_SOURCES += [
'AsanOptions.cpp',
]
LIBRARY_NAME = 'mozglue'