Skip to content

[TSAN] Crash while creating a vulkan device #165104

@maxbachmann

Description

@maxbachmann

The original issue for this can be found in: google/sanitizers#1678
However since the repo mentions that issues should be opened here, this opens the same issue here.

There is a crash on a memory read inside of libnvidia-glcore.so when calling vkCreateDevice. This occurs even when attempting to ignore calls from the lib via a suppression file.

Stack trace:

#0 0x00007ffff6e90456 in __sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator64<__tsan::AP64> >::Allocate (class_id=4, allocator=0x7ffff6f55c00 <__tsan::allocator_placeholder>, this=0x8) at /usr/src/debug/gcc/gcc/libsanitizer/sanitizer_common/sanitizer_allocator_local_cache.h:38 #1 __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator64<__tsan::AP64>, __sanitizer::LargeMmapAllocatorPtrArrayDynamic>::Allocate (this=this@entry=0x7ffff6f55c00 <__tsan::allocator_placeholder>, cache=0x8, size=<optimized out>, size@entry=56, alignment=alignment@entry=16) at /usr/src/debug/gcc/gcc/libsanitizer/sanitizer_common/sanitizer_allocator_combined.h:69 #2 0x00007ffff6e8dad2 in __tsan::user_alloc_internal (thr=thr@entry=0x7fef60179f00, pc=140737335538724, sz=sz@entry=56, align=align@entry=16, signal=signal@entry=true) at /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_rtl.h:216 #3 0x00007ffff6e8dd4e in __tsan::user_calloc (thr=thr@entry=0x7fef60179f00, pc=<optimized out>, size=size@entry=1, n=n@entry=56) at /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_mman.cpp:230 #4 0x00007ffff6e4342a in __interceptor_calloc (size=1, n=56) at /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:702 #5 0x00007fefaa0f7aae in ?? () from /usr/lib/libnvidia-glcore.so.535.54.03 #6 0x00007fefaa11335a in ?? () from /usr/lib/libnvidia-glcore.so.535.54.03 #7 0x00007fefaa11218e in ?? () from /usr/lib/libnvidia-glcore.so.535.54.03 #8 0x00007ffff6c9d44b in ?? () from /usr/lib/libc.so.6 #9 0x00007ffff6d20e40 in ?? () from /usr/lib/libc.so.6 

Suppressions file:

called_from_lib:libnvidia-tls.so called_from_lib:libGLX_nvidia.so called_from_lib:libnvidia-glcore.so.535.54.03 called_from_lib:libnvidia-glsi.so called_from_lib:libnvidia-glvkspriv.so called_from_lib:libvulkan.so called_from_lib:libVkLayer_khronos_validation.so 

This continues to happen using the newest nvidia driver and llvm or gcc versions.

The original issue does contain the following explanation for the issue:

The issue arises because malloc/calloc/free calls in the driver are correctly intercepted by TSAN but pthread_* calls are not. The NVIDIA driver is built with older glibc headers, which we need in order to maintain support for older linux distributions. Because of this, the driver picks up old versions of libpthread that TSAN does not interpose. Conversely malloc/calloc/free only have one version, so interposition is unhindered. When a pthread created without TSAN's pthread_create interceptor enters TSAN's calloc interceptor, that ThreadState struct mentioned above is uninitialized, resulting in the segfault.

This issue makes the use of tsan impossible in applications like video games. Is there any workaround for this or a way to handle this in tsan?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions