From: Will Deacon Date: Tue, 19 Jul 2016 14:07:39 +0000 (+0100) Subject: arm64: kprobes: WARN if attempting to step with PSTATE.D=1 X-Git-Tag: firefly_0821_release~176^2~4^2~24^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a1961c0da3b0e3fa8bd803547f96963bf31b69a4;p=firefly-linux-kernel-4.4.55.git arm64: kprobes: WARN if attempting to step with PSTATE.D=1 commit 44bd887ce10eb8061f6a137f8a73f823957edd82 upstream. Stepping with PSTATE.D=1 is bad news. The step won't generate a debug exception and we'll likely walk off into random data structures. This should never happen, but when it does, it's a PITA to debug. Add a WARN_ON to shout if we realise this is about to take place. Signed-off-by: Will Deacon Acked-by: Mark Rutland Signed-off-by: Catalin Marinas Signed-off-by: David A. Long --- diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index f1498b34d1c7..a9b274c99519 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -251,6 +251,8 @@ static void __kprobes setup_singlestep(struct kprobe *p, if (kcb->kprobe_status == KPROBE_REENTER) spsr_set_debug_flag(regs, 0); + else + WARN_ON(regs->pstate & PSR_D_BIT); /* IRQs and single stepping do not mix well. */ kprobes_save_local_irqflag(kcb, regs);