Commit 2d14e39d authored by Anil S Keshavamurthy's avatar Anil S Keshavamurthy Committed by Linus Torvalds

[PATCH] kprobes: enable funcions only for required arch

Kernel/kprobes.c defines get_insn_slot() and free_insn_slot() which are
currently required _only_ for x86_64 and powerpc (which has no-exec support).

FYI, get{free}_insn_slot() functions manages the memory page which is mapped
as executable, required for instruction emulation.

This patch moves those two functions under __ARCH_WANT_KPROBES_INSN_SLOT and
defines __ARCH_WANT_KPROBES_INSN_SLOT in arch specific kprobes.h file.
Signed-off-by: default avatarAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d1c0b8f8
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#define __ARCH_WANT_KPROBES_INSN_SLOT
struct pt_regs; struct pt_regs;
typedef unsigned int kprobe_opcode_t; typedef unsigned int kprobe_opcode_t;
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#define __ARCH_WANT_KPROBES_INSN_SLOT
struct pt_regs; struct pt_regs;
typedef u8 kprobe_opcode_t; typedef u8 kprobe_opcode_t;
......
...@@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock); /* Protects kprobe_table */ ...@@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock); /* Protects kprobe_table */
DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */ DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */
static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; 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 * kprobe->ainsn.insn points to the copy of the instruction to be
* single-stepped. x86_64, POWER4 and above have no-exec support and * 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) ...@@ -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 */ /* We have preemption disabled.. so it is safe to use __ versions */
static inline void set_kprobe_instance(struct kprobe *kp) static inline void set_kprobe_instance(struct kprobe *kp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment