зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1058500 - Add MSan support to the build system. r=ted,waldo
This commit is contained in:
Родитель
d7064be738
Коммит
0d5c56b958
|
@ -28,10 +28,11 @@ AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
|
|||
esac
|
||||
fi
|
||||
|
||||
# if we are debugging, profiling or using ASAN, we want a frame pointer.
|
||||
# if we are debugging, profiling or using sanitizers, we want a frame pointer.
|
||||
if test -z "$MOZ_OPTIMIZE" -o \
|
||||
-n "$MOZ_PROFILING" -o \
|
||||
-n "$MOZ_DEBUG" -o \
|
||||
-n "$MOZ_MSAN" -o \
|
||||
-n "$MOZ_ASAN"; then
|
||||
MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
|
||||
else
|
||||
|
|
16
configure.in
16
configure.in
|
@ -1264,6 +1264,22 @@ if test -n "$MOZ_ASAN"; then
|
|||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_ASAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use Memory Sanitizer
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
|
||||
[ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
|
||||
MOZ_MSAN=1,
|
||||
MOZ_MSAN= )
|
||||
if test -n "$MOZ_MSAN"; then
|
||||
MOZ_LLVM_HACKS=1
|
||||
AC_DEFINE(MOZ_MSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_MSAN)
|
||||
|
||||
# The LLVM symbolizer is used by all sanitizers
|
||||
AC_SUBST(LLVM_SYMBOLIZER)
|
||||
|
||||
dnl ========================================================
|
||||
|
|
|
@ -1077,6 +1077,22 @@ if test -n "$MOZ_ASAN"; then
|
|||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_ASAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use Memory Sanitizer
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
|
||||
[ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
|
||||
MOZ_MSAN=1,
|
||||
MOZ_MSAN= )
|
||||
if test -n "$MOZ_MSAN"; then
|
||||
MOZ_LLVM_HACKS=1
|
||||
AC_DEFINE(MOZ_MSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_MSAN)
|
||||
|
||||
# The LLVM symbolizer is used by all sanitizers
|
||||
AC_SUBST(LLVM_SYMBOLIZER)
|
||||
|
||||
dnl ========================================================
|
||||
|
|
|
@ -54,6 +54,29 @@ __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
|||
#define MOZ_MAKE_MEM_DEFINED(addr, size) \
|
||||
__asan_unpoison_memory_region((addr), (size))
|
||||
}
|
||||
#elif defined(MOZ_MSAN)
|
||||
#include <stddef.h>
|
||||
|
||||
#include "mozilla/Types.h"
|
||||
|
||||
extern "C" {
|
||||
/* These definitions are usually provided through the
|
||||
* sanitizer/msan_interface.h header installed by MSan.
|
||||
*/
|
||||
void MOZ_EXPORT
|
||||
__msan_poison(void const volatile *addr, size_t size);
|
||||
void MOZ_EXPORT
|
||||
__msan_unpoison(void const volatile *addr, size_t size);
|
||||
|
||||
#define MOZ_MAKE_MEM_NOACCESS(addr, size) \
|
||||
__msan_poison((addr), (size))
|
||||
|
||||
#define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
|
||||
__msan_poison((addr), (size))
|
||||
|
||||
#define MOZ_MAKE_MEM_DEFINED(addr, size) \
|
||||
__msan_unpoison((addr), (size))
|
||||
}
|
||||
#elif defined(MOZ_VALGRIND)
|
||||
#define MOZ_MAKE_MEM_NOACCESS(addr, size) \
|
||||
VALGRIND_MAKE_MEM_NOACCESS((addr), (size))
|
||||
|
|
Загрузка…
Ссылка в новой задаче