[PATCH] kprobes: enable funcions only for required arch
Changes
3 files changed · +6 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| include/asm-powerpc/kprobes.h | modified | +2 | −0 | View file |
| include/asm-x86_64/kprobes.h | modified | +2 | −0 | View file |
| kernel/kprobes.c | modified | +2 | −0 | View file |
include/asm-powerpc/kprobes.h
View filediff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 0654f79..7c98e54 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -30,6 +30,8 @@
#include <linux/ptrace.h>
#include <linux/percpu.h>
+#define __ARCH_WANT_KPROBES_INSN_SLOT
+
struct pt_regs;
typedef unsigned int kprobe_opcode_t;
include/asm-x86_64/kprobes.h
View filediff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h
index 4dd7a7e..9e2532a 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -27,6 +27,8 @@
#include <linux/ptrace.h>
#include <linux/percpu.h>
+#define __ARCH_WANT_KPROBES_INSN_SLOT
+
struct pt_regs;
typedef u8 kprobe_opcode_t;
kernel/kprobes.c
View filediff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3bb71e6..3897630 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock); /* Protects kprobe_table */
DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */
static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;
+#ifdef __ARCH_WANT_KPROBES_INSN_SLOT
/*
* kprobe->ainsn.insn points to the copy of the instruction to be
* single-stepped. x86_64, POWER4 and above have no-exec support and
@@ -151,6 +152,7 @@ void __kprobes free_insn_slot(kprobe_opcode_t *slot)
}
}
}
+#endif
/* We have preemption disabled.. so it is safe to use __ versions */
static inline void set_kprobe_instance(struct kprobe *kp)