7ee31a3aa8
Commit36dadef23f
("kprobes: Init kprobes in early_initcall") enabled using kprobes from early_initcall. Unfortunately at this point the hardware debug infrastructure is not operational. The OS lock may still be locked, and the hardware watchpoints may have unknown values when kprobe enables debug monitors to single-step instructions. Rather than using hardware single-step, append a BRK instruction after the instruction to be executed out-of-line. Fixes:36dadef23f
("kprobes: Init kprobes in early_initcall") Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Link: https://lore.kernel.org/r/20201103134900.337243-1-jean-philippe@linaro.org Signed-off-by: Will Deacon <will@kernel.org>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* arch/arm64/include/asm/kprobes.h
|
|
*
|
|
* Copyright (C) 2013 Linaro Limited
|
|
*/
|
|
|
|
#ifndef _ARM_KPROBES_H
|
|
#define _ARM_KPROBES_H
|
|
|
|
#include <asm-generic/kprobes.h>
|
|
|
|
#ifdef CONFIG_KPROBES
|
|
#include <linux/types.h>
|
|
#include <linux/ptrace.h>
|
|
#include <linux/percpu.h>
|
|
|
|
#define __ARCH_WANT_KPROBES_INSN_SLOT
|
|
#define MAX_INSN_SIZE 2
|
|
|
|
#define flush_insn_slot(p) do { } while (0)
|
|
#define kretprobe_blacklist_size 0
|
|
|
|
#include <asm/probes.h>
|
|
|
|
struct prev_kprobe {
|
|
struct kprobe *kp;
|
|
unsigned int status;
|
|
};
|
|
|
|
/* Single step context for kprobe */
|
|
struct kprobe_step_ctx {
|
|
unsigned long ss_pending;
|
|
unsigned long match_addr;
|
|
};
|
|
|
|
/* per-cpu kprobe control block */
|
|
struct kprobe_ctlblk {
|
|
unsigned int kprobe_status;
|
|
unsigned long saved_irqflag;
|
|
struct prev_kprobe prev_kprobe;
|
|
struct kprobe_step_ctx ss_ctx;
|
|
};
|
|
|
|
void arch_remove_kprobe(struct kprobe *);
|
|
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
|
|
int kprobe_exceptions_notify(struct notifier_block *self,
|
|
unsigned long val, void *data);
|
|
void kretprobe_trampoline(void);
|
|
void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
|
|
|
|
#endif /* CONFIG_KPROBES */
|
|
#endif /* _ARM_KPROBES_H */
|