Do not terminate the process with ASan on allocator returning 0 13/208613/1 accepted/tizen/base/20190629.012834 submit/tizen_base/20190627.021435
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Wed, 26 Jun 2019 10:41:55 +0000 (13:41 +0300)
committerMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Wed, 26 Jun 2019 10:41:55 +0000 (13:41 +0300)
ASan allocator will not crash and return 0 in case of out-of-memory.

Currently *null* will be returned for the following cases inside internal
allocator:

- Requested size is more than 3 << 30 for 32bits and 1 << 40 for 64bits.
- Requested size overflow.
- RSS limit excided
- mmap syscall returns 0

Change-Id: Iddb84e52153449965bc6de2fd33807478db50cd3

packaging/gcc-contrib.spec

index 185cb3a..bebd73d 100644 (file)
@@ -48,7 +48,7 @@
 %define ubsan_force_options -fsanitize=undefined,bounds-strict,float-divide-by-zero,float-cast-overflow
 %define isan_force_options -fsanitize=unsigned-integer-overflow
 %define tsan_force_options -fsanitize=thread -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
-%define asan_runtime_options halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:full_address_space=true:handle_segv=0:log_path=/tmp/asan.log:log_exe_name=1:fast_unwind_on_fatal=1
+%define asan_runtime_options halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:full_address_space=true:handle_segv=0:log_path=/tmp/asan.log:log_exe_name=1:fast_unwind_on_fatal=1:allocator_may_return_null=1
 %define esan_force_options -fsanitize=efficiency-working-set -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
 %define esan_cache_force_options -fsanitize=efficiency-cache-frag -fno-omit-frame-pointer -Wp,-U_FORTIFY_SOURCE -Wl,--as-needed -ldl -lpthread
 %define ubsan_runtime_options print_cmdline=true:log_path=/tmp/ubsan.log