Closed pendingchaos closed 1 year ago
I'm able to reproduce and building Fossilize with asan does expose something:
=================================================================
==22336==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000060d40 at pc 0x55ee1bd1aa2c bp 0x7fd55e9fd660 sp 0x7fd55e9fd650
WRITE of size 8 at 0x603000060d40 thread T2
#0 0x55ee1bd1aa2b in ThreadedReplayer::complete_work_item(PipelineWorkItem const&) const (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0xe1a2b) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#1 0x55ee1bd1b69d in ThreadedReplayer::run_creation_work_item_graphics_iteration(PipelineWorkItem const&, VkPipelineCache_T*, bool) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0xe269d) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#2 0x55ee1bd1b833 in ThreadedReplayer::run_creation_work_item_graphics(PipelineWorkItem const&) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0xe2833) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#3 0x55ee1bd1cad6 in ThreadedReplayer::run_creation_work_item(PipelineWorkItem const&) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0xe3ad6) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#4 0x55ee1bd1d772 in ThreadedReplayer::worker_thread(unsigned int) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0xe4772) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#5 0x55ee1bde8350 in void std::__invoke_impl<void, void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int>(std::__invoke_memfun_deref, void (ThreadedReplayer::*&&)(unsigned int), ThreadedReplayer*&&, unsigned int&&) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0x1af350) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#6 0x55ee1bde8179 in std::__invoke_result<void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int>::type std::__invoke<void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int>(void (ThreadedReplayer::*&&)(unsigned int), ThreadedReplayer*&&, unsigned int&&) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0x1af179) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#7 0x55ee1bde80ac in void std::thread::_Invoker<std::tuple<void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0x1af0ac) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#8 0x55ee1bde7feb in std::thread::_Invoker<std::tuple<void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int> >::operator()() (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0x1aefeb) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#9 0x55ee1bde7f81 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (ThreadedReplayer::*)(unsigned int), ThreadedReplayer*, unsigned int> > >::_M_run() (/home/maister/git/Fossilize/cmake-build-debug/cli/fossilize-replay+0x1aef81) (BuildId: a81709a321a5faea2d28f812eb7865121a652e4a)
#10 0x7fd5726e1942 in execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#11 0x7fd5724aa9ea (/usr/lib/libc.so.6+0x8c9ea) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
#12 0x7fd57252e71b (/usr/lib/libc.so.6+0x11071b) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
I'll investigate.
Fixed on master.
When replaying control.56e940357de1ece7.foz from our fossil-db (with
RADV_DEBUG=nocache RADV_FORCE_FAMILY=gfx1100
and--num-threads 1
), it will eventually crash:This is:
From the ASan output, I decided it's Fossilize bug.
Output when running with ASan
``` ================================================================= ==78062==ERROR: AddressSanitizer: heap-use-after-free on address 0x62000014c4fc at pc 0x7f82a0e6eb32 bp 0x7f8285bbf270 sp 0x7f8285bbea30 READ of size 4 at 0x62000014c4fc thread T3 #0 0x7f82a0e6eb31 in __interceptor_memcpy (/usr/lib64/libasan.so.8+0x6eb31) (BuildId: e5f0a0d511a659fbc47bf41072869139cb2db47f) #1 0x7f8298141462 in blob_copy_bytes ../../../../../../../mesa/src/util/blob.c:301 #2 0x7f8298141946 in blob_read_uint32 ../../../../../../../mesa/src/util/blob.c:324 #3 0x7f8298ade447 in decode_type_from_blob ../../../../../../../mesa/src/compiler/glsl_types.cpp:3081 #4 0x7f8298a52bda in read_variable ../../../../../../../mesa/src/compiler/nir/nir_serialize.c:365 #5 0x7f8298a549cb in read_var_list ../../../../../../../mesa/src/compiler/nir/nir_serialize.c:443 #6 0x7f8298a6daf1 in nir_deserialize ../../../../../../../mesa/src/compiler/nir/nir_serialize.c:2073 #7 0x7f829785c1b0 in radv_pipeline_import_retained_shaders ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:2360 #8 0x7f829785ce53 in radv_pipeline_load_retained_shaders ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:2392 #9 0x7f8297862d50 in radv_graphics_pipeline_compile ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:2702 #10 0x7f8297879010 in radv_graphics_pipeline_init ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:3975 #11 0x7f829787ae61 in radv_graphics_pipeline_create ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:4074 #12 0x7f829787caf0 in radv_CreateGraphicsPipelines ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:4217 #13 0x42b9fa in ThreadedReplayer::worker_thread(unsigned int) (/home/pendingchaos/valve-dev/Fossilize/build/cli/fossilize-replay+0x42b9fa) (BuildId: 8e68b05e509c476827f7d2574c59e4d64c6d9f5c) #14 0x7f82a0ae31f2 in execute_native_thread_routine (/lib64/libstdc++.so.6+0xe31f2) (BuildId: 65f174befecd93031976ef77c0c77fdcea95fdc8) #15 0x7f82a08ae946 in start_thread (/lib64/libc.so.6+0x8c946) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25) #16 0x7f82a093486f in __clone3 (/lib64/libc.so.6+0x11286f) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25) 0x62000014c4fc is located 1148 bytes inside of 3600-byte region [0x62000014c080,0x62000014ce90) freed by thread T0 here: #0 0x7f82a0ed7fb8 in __interceptor_free.part.0 (/usr/lib64/libasan.so.8+0xd7fb8) (BuildId: e5f0a0d511a659fbc47bf41072869139cb2db47f) #1 0x7f829787c800 in radv_destroy_graphics_lib_pipeline ../../../../../../../mesa/src/amd/vulkan/radv_pipeline_graphics.c:4195 #2 0x7f82977f5d34 in radv_pipeline_destroy ../../../../../../../mesa/src/amd/vulkan/radv_pipeline.c:97 #3 0x7f82977f5fa1 in radv_DestroyPipeline ../../../../../../../mesa/src/amd/vulkan/radv_pipeline.c:126 #4 0x4300e7 in std::_Function_handler