]> granicus.if.org Git - gc/commit
Support AddressSanitizer and MemorySanitizer (clang)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 15 Nov 2016 14:35:40 +0000 (17:35 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 27 Nov 2016 07:13:12 +0000 (10:13 +0300)
commita5865bff3bc9de26bd1b0a0c92fbb69e98764421
treef05ef17b6519bd94ad4e42512db7d0135455cd2e
parent0ae461eb775d276a24a34defd3312cb80e88d33a
Support AddressSanitizer and MemorySanitizer (clang)

* include/private/gc_priv.h (GC_ATTR_NO_SANITIZE_ADDR,
GC_ATTR_NO_SANITIZE_MEMORY): New macro.
* include/private/gcconfig.h [__has_feature(address_sanitizer)]
(ADDRESS_SANITIZER): New macro.
* include/private/gcconfig.h [__has_feature(memory_sanitizer)]
(MEMORY_SANITIZER): Likewise.
* mach_dep.c (GC_with_callee_saves_pushed): Use
GC_ATTR_NO_SANITIZE_ADDR attribute.
* mark.c (GC_mark_from, GC_push_all_eager): Likewise.
* mark.c (GC_mark_from, GC_push_all_eager): Use
GC_ATTR_NO_SANITIZE_MEMORY attribute.
* os_dep.c [ADDRESS_SANITIZER && (UNIX_LIKE || NEED_FIND_LIMIT
|| MPROTECT_VDB)] (__asan_default_options): New function.
* os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE) && CPPCHECK
&& ADDRESS_SANITIZER] (GC_set_and_save_fault_handler):
Reference __asan_default_options.
* os_dep.c [MPROTECT_VDB && !DARWIN && CPPCHECK && ADDRESS_SANITIZER]
(GC_dirty_init): Likewise.
* tests/test.c [MEMORY_SANITIZER] (check_heap_stats): Increase
max_heap_sz by 25% (to avoid "Unexpected heap growth" error if MSan is
used).
* tests/test_cpp.cc [ADDRESS_SANITIZER || MEMORY_SANITIZER] (main):
Call GC_FREE(a) instead of delete a; add comment.
include/private/gc_priv.h
include/private/gcconfig.h
mach_dep.c
mark.c
os_dep.c
tests/test.c
tests/test_cpp.cc