CRASH on AArch64 in sigcontext_to_mcontext_simd() in client.signal test
The client.signal test, after porting to a64, hits this crash:
Thread 1 "client.signal" received signal SIGSEGV, Segmentation fault.
0x000000007135abc4 in sigcontext_to_mcontext_simd (mc=0xfffd7402b380, sc_full=0xfffd7402b290) at /home/derek/dr/src/core/unix/signal_linux_aarch64.c:73
73 ASSERT(fpc->head.magic == FPSIMD_MAGIC);
(gdb) bt
#0 0x000000007135abc4 in sigcontext_to_mcontext_simd (mc=0xfffd7402b380, sc_full=0xfffd7402b290)
at /home/derek/dr/src/core/unix/signal_linux_aarch64.c:73
#1 0x00000000713329cc in sigcontext_to_mcontext (mc=0xfffd7402b380, sc_full=0xfffd7402b290, flags=DR_MC_ALL)
at /home/derek/dr/src/core/unix/signal.c:2438
#2 0x000000007131a410 in os_context_to_mcontext (dmc=0xfffd7402b370, mc=0x0, osc=...) at /home/derek/dr/src/core/unix/os.c:3744
#3 0x00000000711f7e24 in dr_get_mcontext_priv (dcontext=0xfffd74005080, dmc=0xfffd7402b370, mc=0x0) at /home/derek/dr/src/core/lib/instrument.c:6745
#4 0x00000000711f8108 in dr_get_mcontext (drcontext=0xfffd74005080, dmc=0xfffd7402b370) at /home/derek/dr/src/core/lib/instrument.c:6827
#5 0x0000ffff73f904d0 in kernel_xfer_event (drcontext=0xfffd74005080, info=0xfffd7402ba68)
at /home/derek/dr/src/suite/tests/client-interface/signal.dll.c:75
#6 0x00000000711ec608 in instrument_kernel_xfer (dcontext=0xfffd74005080, type=DR_XFER_SIGNAL_RETURN, source_os_cxt=..., source_dmc=0x0,
source_mc=0xfffd74005080, target_pc=0xffffb7c38c98 <chain_fragments_for_flush+2744> "\037\374?\261B", target_xsp=281474976707616,
target_os_cxt=..., target_mc=0x0, sig=23) at /home/derek/dr/src/core/lib/instrument.c:2243
#7 0x000000007133f2f4 in handle_sigreturn (dcontext=0xfffd74005080, rt=true) at /home/derek/dr/src/core/unix/signal.c:6311
#8 0x0000000071323b28 in pre_system_call (dcontext=0xfffd74005080) at /home/derek/dr/src/core/unix/os.c:7087
#9 0x00000000710b6dd4 in handle_system_call (dcontext=0xfffd74005080) at /home/derek/dr/src/core/dispatch.c:1990
#10 0x00000000710af034 in dispatch_enter_dynamorio (dcontext=0xfffd74005080) at /home/derek/dr/src/core/dispatch.c:889
#11 0x00000000710aa7bc in d_r_dispatch (dcontext=0xfffd74005080) at /home/derek/dr/src/core/dispatch.c:164
I'm assuming that the fp_simd_state
pointer in the signal frame can be NULL, just like for x86, and this just needs a check for that.