• Will Deacon's avatar
    arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP · 43d95069
    Will Deacon authored
    commit 3a402a70 upstream.
    
    When TIF_SINGLESTEP is set for a task, the single-step state machine is
    enabled and we must take care not to reset it to the active-not-pending
    state if it is already in the active-pending state.
    
    Unfortunately, that's exactly what user_enable_single_step does, by
    unconditionally setting the SS bit in the SPSR for the current task.
    This causes failures in the GDB testsuite, where GDB ends up missing
    expected step traps if the instruction being stepped generates another
    trap, e.g. PTRACE_EVENT_FORK from an SVC instruction.
    
    This patch fixes the problem by preserving the current state of the
    stepping state machine when TIF_SINGLESTEP is set on the current thread.
    Reported-by: default avatarYao Qi <yao.qi@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    43d95069
debug-monitors.c 10 KB