ASAN and TSAN support on macOS

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

ASAN and TSAN support on macOS

Postby robs » Wed Apr 29, 2020 11:40 am

I'd like to use ASAN (or TSAN) with my application which uses CEF on macOS. I'm not trying to find issues in CEF itself but issues in my application. If I enable either of these sanitizers, using a standard CEF release build, then I get a crash (see below). Does anyone know of a way to work around this? Ideally I wouldn't need to rebuild CEF for this.

I found this page:
https://chromium.googlesource.com/chrom ... allocator/

which says:
Mac/iOS use_allocator: none, we always use the system's allocator implementation.
In addition, when building for asan / msan both the allocator and the shim layer are disabled.


Perhaps there is a way to disable the allocator and shim layer at runtime?

Thanks for any suggestions!

Rob

Call stack of the crash. Note, the crash is my main process, just allocating some memory when doing some NSView stuff:
Code: Select all
#0   0x000000011115a4d8 in base::allocator::GetFunctionsForZone(void*)::'lambda'()::operator()() const [inlined] at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/malloc_zone_functions_mac.h:97
#1   0x000000011115a4d7 in base::allocator::GetFunctionsForZone(void*) [inlined] at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/malloc_zone_functions_mac.h:97
#2   0x000000011115a495 in base::allocator::(anonymous namespace)::MallocImpl(base::allocator::AllocatorDispatch const*, unsigned long, void*) at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc:18
#3   0x000000011115a20d in ShimMalloc [inlined] at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/allocator_shim.cc:192
#4   0x000000011115a1f0 in base::allocator::MallocZoneFunctionsToReplaceDefault()::$_2::operator()(_malloc_zone_t*, unsigned long) const [inlined] at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/allocator_shim_override_mac_symbols.h:23
#5   0x000000011115a1f0 in base::allocator::MallocZoneFunctionsToReplaceDefault()::$_2::__invoke(_malloc_zone_t*, unsigned long) at /Users/spotify-buildagent/buildAgent/work/CEF3_git/chromium/src/base/allocator/allocator_shim_override_mac_symbols.h:22
#6   0x00007fff7e5dcc99 in malloc_zone_malloc ()
#7   0x00007fff7e5de191 in malloc_set_zone_name ()
#8   0x0000000104e0868a in wrap_malloc_set_zone_name ()
#9   0x0000000105a8bf1b in _dispatch_client_callout ()
#10   0x0000000105a8dba9 in _dispatch_once_callout ()
#11   0x00007fff5cf1a32d in get_malloc_zone(unsigned long) ()
#12   0x00007fff5cf1a57a in CA::Transaction::set_disable_actions(bool) ()
#13   0x00007fff4faf95a0 in -[NSView _updateLayerBackedness] ()
robs
Mentor
 
Posts: 70
Joined: Wed Jun 05, 2013 2:22 pm

Re: ASAN and TSAN support on macOS

Postby magreenblatt » Wed Apr 29, 2020 11:58 am

You will need to create a local build of CEF/Chromium based on the instructions here. Specifically, you need to create a Release build with the "is_asan=true" GN argument, and then run the resulting binary using the "tools/valgrind/asan/asan_symbolize.py" filter script provided by Chromium. There are some additional details specific to usage with CEF on Linux here.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: ASAN and TSAN support on macOS

Postby robs » Wed Apr 29, 2020 12:06 pm

Thanks for the quick reply.

Best,
Rob
robs
Mentor
 
Posts: 70
Joined: Wed Jun 05, 2013 2:22 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 32 guests