OSDN Git Service

arm64: kprobes: WARN if attempting to step with PSTATE.D=1
authorWill Deacon <will.deacon@arm.com>
Tue, 19 Jul 2016 14:07:39 +0000 (15:07 +0100)
committerAlex Shi <alex.shi@linaro.org>
Thu, 20 Oct 2016 07:38:13 +0000 (15:38 +0800)
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 <will.deacon@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: David A. Long <dave.long@linaro.org>
arch/arm64/kernel/probes/kprobes.c

index f1498b3..a9b274c 100644 (file)
@@ -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);