Open stevenwdv opened 9 months ago
I had the same thoughts as the reporter, only difference is that we use ubuntu images (mantic), it can be reproduced there, too. Usually, it fails about 8-10 times from 50ish runs. However, using ubuntu:noble (not yet released LTS version, packed with clang-17), it successfully run for more than 2K times. Using clang-16 in ubuntu:noble produces the crash, so somewhere between 16 and 17 it got fixed. Exact versions: Ubuntu clang version 16.0.6 (19build1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
and
Ubuntu clang version 17.0.6 (5build1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
Same here, Ubuntu mantic, but also under our CI. It's intermittant, but compiled code crashes 219 of 1000 runs.
Here's our trivial code:
/* Test program generated by configurator. */
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return __builtin_choose_expr(1, 0, "garbage");}
It's compiled with clang -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition -Werror -std=gnu11 -g -fstack-protector-strong -fsanitize=address -fno-sanitize-recover=address -fsanitize=undefined -fno-sanitize-recover=undefined -I/usr/local/lib -L/usr/local/lib -I/usr/include/postgresql -oconfigurator.out configuratortest.c
.
Without -fsanitize=address
there are no failures at all.
Using LSAN_OPTIONS=verbosity=1:log_threads=1
here are a successful and an unsuccessful run:
$ LSAN_OPTIONS=verbosity=1:log_threads=1 ./configurator.out
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_printf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_sprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_snprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_fprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_vprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_vsprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_vsnprintf'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__isoc99_vfprintf'
==4010141==Registered root region at 0x730a51f01310 of size 80
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51f01310 of size 80
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'pthread_mutexattr_getrobust_np'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdrmem_create'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdrstdio_create'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_short'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_short'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_int'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_int'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_long'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_long'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_hyper'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_hyper'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_longlong_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_longlong_t'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_int8_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_uint8_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_int16_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_uint16_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_int32_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_uint32_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_int64_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_uint64_t'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_quad_t'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_quad_t'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_bool'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_enum'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_char'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_u_char'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_float'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_double'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_bytes'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_string'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdrrec_create'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'xdr_destroy'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'crypt'
==4010141==Registered root region at 0x730a51d00b70 of size 48
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51d00b70 of size 48
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept 'crypt_r'
==4010141==Registered root region at 0x730a52500f40 of size 64
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a52500f40 of size 64
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__cxa_throw'
==4010141==Registered root region at 0x730a51f01310 of size 80
==4010141==Registered root region at 0x730a521007a0 of size 32
==4010141==Unregistered root region at 0x730a51f01310 of size 80
==4010141==Unregistered root region at 0x730a521007a0 of size 32
==4010141==AddressSanitizer: failed to intercept '__cxa_rethrow_primary_exception'
==4010141==AddressSanitizer: libc interceptors initialized
|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem ||
|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||
|| `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap ||
|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow ||
|| `[0x000000000000, 0x00007fff7fff]` || LowMem ||
MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff
redzone=16
max_redzone=2048
quarantine_size_mb=256M
thread_local_quarantine_size_kb=1024K
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x7fff8000
==4010141==Installed the sigaction for signal 11
==4010141==Installed the sigaction for signal 7
==4010141==Installed the sigaction for signal 8
==4010141==T0: FakeStack created: 0x730a509f7000 -- 0x730a51500000 stack_size_log: 20; mmapped 11300K, noreserve=0
==4010141==T0: stack [0x7ffe61445000,0x7ffe61c45000) size 0x800000; local=0x7ffe61c42504
==4010141==AddressSanitizer Init done
==4010141==LeakSanitizer: checking for leaks==4010142==Processing thread 4010141.
==4010142==Stack at 0x7ffe61445000-0x7ffe61c45000 (SP = 0x7ffe61c42350).
==4010142==TLS at 0x730a52ca8900-0x730a52ca99c0.
Here's the failed one:
$ LSAN_OPTIONS=verbosity=1:log_threads=1 ./configurator.out
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_printf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_sprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_snprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_fprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_vprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_vsprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_vsnprintf'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__isoc99_vfprintf'
==4010153==Registered root region at 0x7542f0d01310 of size 80
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0d01310 of size 80
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'pthread_mutexattr_getrobust_np'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdrmem_create'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdrstdio_create'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_short'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_short'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_int'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_int'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_long'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_long'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_hyper'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_hyper'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_longlong_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_longlong_t'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_int8_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_uint8_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_int16_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_uint16_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_int32_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_uint32_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_int64_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_uint64_t'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_quad_t'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_quad_t'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_bool'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_enum'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_char'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_u_char'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_float'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_double'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_bytes'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_string'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdrrec_create'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'xdr_destroy'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'crypt'
==4010153==Registered root region at 0x7542f0b00b70 of size 48
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0b00b70 of size 48
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept 'crypt_r'
==4010153==Registered root region at 0x7542f1300f40 of size 64
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f1300f40 of size 64
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__cxa_throw'
==4010153==Registered root region at 0x7542f0d01310 of size 80
==4010153==Registered root region at 0x7542f0f007a0 of size 32
==4010153==Unregistered root region at 0x7542f0d01310 of size 80
==4010153==Unregistered root region at 0x7542f0f007a0 of size 32
==4010153==AddressSanitizer: failed to intercept '__cxa_rethrow_primary_exception'
==4010153==AddressSanitizer: libc interceptors initialized
|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem ||
|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||
|| `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap ||
|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow ||
|| `[0x000000000000, 0x00007fff7fff]` || LowMem ||
MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff
redzone=16
max_redzone=2048
quarantine_size_mb=256M
thread_local_quarantine_size_kb=1024K
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x7fff8000
==4010153==Installed the sigaction for signal 11
==4010153==Installed the sigaction for signal 7
==4010153==Installed the sigaction for signal 8
Segmentation fault (core dumped)
Other info:
$ clang --version
Ubuntu clang version 16.0.6 (15)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
I must be doing something wrong because I cannot get address sanitizer or memory sanitizer to work without randomly crashing on a minimal C program, even on a fresh install via Docker. I can't imagine this not being reported but yet I can't find anything on this.
Repro
The docker part if of course optional, but I used it to verify that it was not just my install.
``` ======== Testing -fsanitize=address ======== Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 1 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 3 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 4 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 8 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 11 executions ``` [...etc...] ``` ======== Testing -fsanitize=memory ======== Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 5 executions FATAL: Code 0x621db9d8f410 is out of application range. Non-PIE build? FATAL: MemorySanitizer can not mmap the shadow memory. FATAL: Make sure to compile with -fPIE and to link with -pie. FATAL: Disabling ASLR is known to cause this error. FATAL: If running under GDB, try 'set disable-randomization off'. ==4516==Process memory map follows: 0x621db9d45000-0x621db9d66000 /a.out 0x621db9d66000-0x621db9ded000 /a.out 0x621db9ded000-0x621db9e19000 /a.out 0x621db9e19000-0x621db9e1a000 /a.out 0x621db9e1a000-0x621db9e1d000 /a.out 0x621db9e1d000-0x621dbb771000 0x7f93eb300000-0x7f93eb400000 0x7f93eb500000-0x7f93eb600000 0x7f93eb700000-0x7f93eb800000 0x7f93eb900000-0x7f93eba00000 0x7f93eba1c000-0x7f93ebdc1000 0x7f93ebdc1000-0x7f93ebde7000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7f93ebde7000-0x7f93ebf3c000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7f93ebf3c000-0x7f93ebf8f000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7f93ebf8f000-0x7f93ebf93000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7f93ebf93000-0x7f93ebf95000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7f93ebf95000-0x7f93ebfa2000 0x7f93ebfa2000-0x7f93ebfa5000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f93ebfa5000-0x7f93ebfbc000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f93ebfbc000-0x7f93ebfc0000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f93ebfc0000-0x7f93ebfc1000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f93ebfc1000-0x7f93ebfc2000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7f93ebfc2000-0x7f93ebfd2000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7f93ebfd2000-0x7f93ec045000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7f93ec045000-0x7f93ec09f000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7f93ec09f000-0x7f93ec0a0000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7f93ec0a0000-0x7f93ec0a1000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7f93ec0a1000-0x7f93ec0a8000 0x7f93ec0a8000-0x7f93ec0a9000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7f93ec0a9000-0x7f93ec0ce000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7f93ec0ce000-0x7f93ec0d8000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7f93ec0d8000-0x7f93ec0da000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7f93ec0da000-0x7f93ec0dc000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7ffc351dd000-0x7ffc351fe000 [stack] 0x7ffc352f2000-0x7ffc352f6000 [vvar] 0x7ffc352f6000-0x7ffc352f8000 [vdso] 0xffffffffff600000-0xffffffffff601000 [vsyscall] ==4516==End of process memory map. >>>> Crashed with exit code 1 after 6 executions FATAL: Code 0x620a33be2410 is out of application range. Non-PIE build? FATAL: MemorySanitizer can not mmap the shadow memory. FATAL: Make sure to compile with -fPIE and to link with -pie. FATAL: Disabling ASLR is known to cause this error. FATAL: If running under GDB, try 'set disable-randomization off'. ==4520==Process memory map follows: 0x620a33b98000-0x620a33bb9000 /a.out 0x620a33bb9000-0x620a33c40000 /a.out 0x620a33c40000-0x620a33c6c000 /a.out 0x620a33c6c000-0x620a33c6d000 /a.out 0x620a33c6d000-0x620a33c70000 /a.out 0x620a33c70000-0x620a355c4000 0x72b55c400000-0x72b55c500000 0x72b55c600000-0x72b55c700000 0x72b55c800000-0x72b55c900000 0x72b55ca00000-0x72b55cb00000 0x72b55cb6a000-0x72b55cf0f000 0x72b55cf0f000-0x72b55cf35000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x72b55cf35000-0x72b55d08a000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x72b55d08a000-0x72b55d0dd000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x72b55d0dd000-0x72b55d0e1000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x72b55d0e1000-0x72b55d0e3000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x72b55d0e3000-0x72b55d0f0000 0x72b55d0f0000-0x72b55d0f3000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x72b55d0f3000-0x72b55d10a000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x72b55d10a000-0x72b55d10e000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x72b55d10e000-0x72b55d10f000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x72b55d10f000-0x72b55d110000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x72b55d110000-0x72b55d120000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x72b55d120000-0x72b55d193000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x72b55d193000-0x72b55d1ed000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x72b55d1ed000-0x72b55d1ee000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x72b55d1ee000-0x72b55d1ef000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x72b55d1ef000-0x72b55d1f6000 0x72b55d1f6000-0x72b55d1f7000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x72b55d1f7000-0x72b55d21c000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x72b55d21c000-0x72b55d226000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x72b55d226000-0x72b55d228000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x72b55d228000-0x72b55d22a000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7ffe55fa5000-0x7ffe55fc6000 [stack] 0x7ffe55fec000-0x7ffe55ff0000 [vvar] 0x7ffe55ff0000-0x7ffe55ff2000 [vdso] 0xffffffffff600000-0xffffffffff601000 [vsyscall] ==4520==End of process memory map. >>>> Crashed with exit code 1 after 10 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 12 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 14 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 16 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 18 executions FATAL: Code 0x61ebf49bc410 is out of application range. Non-PIE build? FATAL: MemorySanitizer can not mmap the shadow memory. FATAL: Make sure to compile with -fPIE and to link with -pie. FATAL: Disabling ASLR is known to cause this error. FATAL: If running under GDB, try 'set disable-randomization off'. ==4530==Process memory map follows: 0x61ebf4972000-0x61ebf4993000 /a.out 0x61ebf4993000-0x61ebf4a1a000 /a.out 0x61ebf4a1a000-0x61ebf4a46000 /a.out 0x61ebf4a46000-0x61ebf4a47000 /a.out 0x61ebf4a47000-0x61ebf4a4a000 /a.out 0x61ebf4a4a000-0x61ebf639e000 0x7d9a31f00000-0x7d9a32000000 0x7d9a32100000-0x7d9a32200000 0x7d9a32300000-0x7d9a32400000 0x7d9a32500000-0x7d9a32600000 0x7d9a326d7000-0x7d9a32a7c000 0x7d9a32a7c000-0x7d9a32aa2000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7d9a32aa2000-0x7d9a32bf7000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7d9a32bf7000-0x7d9a32c4a000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7d9a32c4a000-0x7d9a32c4e000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7d9a32c4e000-0x7d9a32c50000 /usr/lib/x86_64-linux-gnu/libc.so.6 0x7d9a32c50000-0x7d9a32c5d000 0x7d9a32c5d000-0x7d9a32c60000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7d9a32c60000-0x7d9a32c77000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7d9a32c77000-0x7d9a32c7b000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7d9a32c7b000-0x7d9a32c7c000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7d9a32c7c000-0x7d9a32c7d000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 0x7d9a32c7d000-0x7d9a32c8d000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7d9a32c8d000-0x7d9a32d00000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7d9a32d00000-0x7d9a32d5a000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7d9a32d5a000-0x7d9a32d5b000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7d9a32d5b000-0x7d9a32d5c000 /usr/lib/x86_64-linux-gnu/libm.so.6 0x7d9a32d5c000-0x7d9a32d63000 0x7d9a32d63000-0x7d9a32d64000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7d9a32d64000-0x7d9a32d89000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7d9a32d89000-0x7d9a32d93000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7d9a32d93000-0x7d9a32d95000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7d9a32d95000-0x7d9a32d97000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 0x7ffef7fee000-0x7ffef800f000 [stack] 0x7ffef8045000-0x7ffef8049000 [vvar] 0x7ffef8049000-0x7ffef804b000 [vdso] 0xffffffffff600000-0xffffffffff601000 [vsyscall] ==4530==End of process memory map. >>>> Crashed with exit code 1 after 20 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 21 executions Segmentation fault (core dumped) >>>> Crashed with exit code 139 SIGSEGV after 22 executions ``` [...etc...]Output
I did try explicitly adding
-fPIE -Wl,-pie
but it did not make a difference.