CRASH on detach at -loglevel 4 in dump_unmasked
I hit this crash while running the tool.drcacheoff.gencode test for #2062.
The info->sighand
has been freed and set to NULL, but afterward some diagnostic code tries to read it.
<Detaching from application /dr/git/build_x64_dbg_tests/suite/tests/bin/tool.drcacheoff.gencode (1413152)>
<Detaching from process, entering final cleanup>
drmemtrace exiting process 1413152; traced 16429 references in 5 writeouts.
flush_instr_encodings: Wrote 92/92 bytes to encoding file
Wrote 92 bytes to encoding file
Program received signal SIGSEGV, Segmentation fault.
0x00005555558879fb in dump_unmasked (dcontext=0x7ffdf7a70080, where=0x555555a13cd0 <__FUNCTION__.24> "signal_swap_mask")
at /dr/git/src/core/unix/signal.c:338
338 LOG(THREAD, LOG_ASYNCH, 3, "[%d]=%d ", i, info->sighand->threads_unmasked[i]);
(gdb) bt
#0 0x00005555558879fb in dump_unmasked (dcontext=0x7ffdf7a70080, where=0x555555a13cd0 <__FUNCTION__.24> "signal_swap_mask")
at /dr/git/src/core/unix/signal.c:338
#1 0x000055555588dec0 in signal_swap_mask (dcontext=0x7ffdf7a70080, to_app=true) at /dr/git/src/core/unix/signal.c:2415
#2 0x000055555588b038 in signal_thread_exit (dcontext=0x7ffdf7a70080, other_thread=false) at /dr/git/src/core/unix/signal.c:1548
#3 0x00005555558708be in os_thread_exit (dcontext=0x7ffdf7a70080, other_thread=false) at /dr/git/src/core/unix/os.c:2495
#4 0x00005555555f495c in dynamo_thread_exit_common (dcontext=0x7ffdf7a70080, id=1413152, other_thread=false)
at /dr/git/src/core/dynamo.c:2621
#5 0x00005555555f4b40 in dynamo_thread_exit () at /dr/git/src/core/dynamo.c:2693
#6 0x00005555555f24b0 in dynamo_shared_exit (toexit=0x7ffdf7a1bda0) at /dr/git/src/core/dynamo.c:1116
#7 0x00005555557820ad in detach_on_permanent_stack (internal=true, do_cleanup=true, drstats=0x0) at /dr/git/src/core/synch.c:2267
#8 0x00005555555f54ef in dr_app_stop_and_cleanup_with_stats (drstats=0x0) at /dr/git/src/core/dynamo.c:2833
#9 0x00005555555f54a0 in dr_app_stop_and_cleanup () at /dr/git/src/core/dynamo.c:2816
#10 0x00005555555dda46 in gather_trace () at /dr/git/src/clients/drcachesim/tests/burst_gencode.cpp:206
#11 0x00005555555dddf9 in main (argc=1, argv=0x7fffffffd998) at /dr/git/src/clients/drcachesim/tests/burst_gencode.cpp:250
(gdb) p info
$1 = (thread_sig_info_t *) 0x7ffdf7a89148
(gdb) p info->sighand
$2 = (sighand_info_t *) 0x0
(gdb) q