set_regs() can update a stopped debuggee while running in the debugger's
thread. When the supplied SPSR has PSR_SS set, mark the target PCB for
single-stepping, but do not set MDSCR_EL1.SS on the debugger's CPU. The
context-switch code enables the hardware state when the target runs.
Writing the CPU register for another thread can leave SS enabled without
PCB_SINGLE_STEP in the current thread. Context switches then need not
clear it, and unrelated processes can receive SIGTRAP/TRAP_TRACE on that
CPU, even after the debugger exits.
Apply the same restriction to set_mcontext(), which thr_create() can call
for a newly allocated thread. Preserve immediate hardware updates when
restoring the current thread's context, including sigreturn().
Fixes: 31cf95cec738 ("Stop single stepping in signal handers on arm64")
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation