Re: [PATCH 2/7] kprobes: Add kprobe_insn_mutex and cleanup arch_remove_kprobe()

From: Masami Hiramatsu
Date: Thu Nov 13 2008 - 23:07:25 EST


Hi Andrew,

Andrew Morton wrote:
On Tue, 11 Nov 2008 15:56:21 -0500
Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

Add kprobe_insn_mutex for protecting kprobe_insn_pages hlist, and remove
kprobe_mutex from architecture dependent code.

This allows us to call arch_remove_kprobe() (and free_insn_slot) while holding
kprobe_mutex.

Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
---
arch/arm/kernel/kprobes.c | 2 --
arch/ia64/kernel/kprobes.c | 8 +++++---
arch/powerpc/kernel/kprobes.c | 7 ++++---
arch/s390/kernel/kprobes.c | 7 ++++---
arch/x86/kernel/kprobes.c | 7 ++++---
include/linux/kprobes.h | 1 -
kernel/kprobes.c | 25 +++++++++++++++++++++----

For some reasons sparc64 never had this mutex. You've checked that
sparc64 will be OK after this change?

I think it's OK for those archs.

Actually, this mutex is protecting insn_slot which stores copied
instructions into executable memory. Some architectures which
doesn't need that special memory have its own buffer in the
arch_specific_insn and they don't use insn_slot. On those arch,
kprobe_insn_mutex is not used (not defined).

Thank you,

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@xxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/