Patch "arm64: kprobes: Restore local irqflag if kprobes is cancelled" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    arm64: kprobes: Restore local irqflag if kprobes is cancelled

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-kprobes-restore-local-irqflag-if-kprobes-is-ca.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e0073fbe3c29024acd9cb33602c31a3d44e7f083
Author: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
Date:   Mon Apr 12 17:41:01 2021 +0800

    arm64: kprobes: Restore local irqflag if kprobes is cancelled
    
    [ Upstream commit 738fa58ee1328481d1d7889e7c430b3401c571b9 ]
    
    If instruction being single stepped caused a page fault, the kprobes
    is cancelled to let the page fault handler continue as a normal page
    fault. But the local irqflags are disabled so cpu will restore pstate
    with DAIF masked. After pagefault is serviced, the kprobes is
    triggerred again, we overwrite the saved_irqflag by calling
    kprobes_save_local_irqflag(). NOTE, DAIF is masked in this new saved
    irqflag. After kprobes is serviced, the cpu pstate is retored with
    DAIF masked.
    
    This patch is inspired by one patch for riscv from Liao Chang.
    
    Signed-off-by: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
    Acked-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210412174101.6bfb0594@xhacker.debian
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
index f11a1a1f7026..798c3e78b84b 100644
--- a/arch/arm64/kernel/probes/kprobes.c
+++ b/arch/arm64/kernel/probes/kprobes.c
@@ -286,10 +286,12 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
 		if (!instruction_pointer(regs))
 			BUG();
 
-		if (kcb->kprobe_status == KPROBE_REENTER)
+		if (kcb->kprobe_status == KPROBE_REENTER) {
 			restore_previous_kprobe(kcb);
-		else
+		} else {
+			kprobes_restore_local_irqflag(kcb, regs);
 			reset_current_kprobe();
+		}
 
 		break;
 	case KPROBE_HIT_ACTIVE:



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux