|
@@ -32,6 +32,7 @@
|
|
|
#include <linux/irqflags.h>
|
|
|
#include <linux/notifier.h>
|
|
|
#include <linux/kallsyms.h>
|
|
|
+#include <linux/kprobes.h>
|
|
|
#include <linux/percpu.h>
|
|
|
#include <linux/kdebug.h>
|
|
|
#include <linux/kernel.h>
|
|
@@ -243,6 +244,20 @@ static int arch_build_bp_info(struct perf_event *bp)
|
|
|
info->type = X86_BREAKPOINT_RW;
|
|
|
break;
|
|
|
case HW_BREAKPOINT_X:
|
|
|
+ /*
|
|
|
+ * We don't allow kernel breakpoints in places that are not
|
|
|
+ * acceptable for kprobes. On non-kprobes kernels, we don't
|
|
|
+ * allow kernel breakpoints at all.
|
|
|
+ */
|
|
|
+ if (bp->attr.bp_addr >= TASK_SIZE_MAX) {
|
|
|
+#ifdef CONFIG_KPROBES
|
|
|
+ if (within_kprobe_blacklist(bp->attr.bp_addr))
|
|
|
+ return -EINVAL;
|
|
|
+#else
|
|
|
+ return -EINVAL;
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
info->type = X86_BREAKPOINT_EXECUTE;
|
|
|
/*
|
|
|
* x86 inst breakpoints need to have a specific undefined len.
|