thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
is meaningless, this change is similar with x86 and powerpc.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Guo Ren <guoren@kernel.org>
Fixes: 74784081aac8 ("riscv: Add uprobes supported")
Link: https://lore.kernel.org/r/1682214146-3756-1-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
        struct uprobe_task *utask = current->utask;
 
        WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
+       current->thread.bad_cause = utask->autask.saved_cause;
 
        instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
 
 {
        struct uprobe_task *utask = current->utask;
 
+       current->thread.bad_cause = utask->autask.saved_cause;
        /*
         * Task has received a fatal signal, so reset back to probbed
         * address.