[PATCH -tip][URGENT] kprobes: Calculate the index correctly whenfreeing the out-of-line execution slot.
From: Masami Hiramatsu
Date: Tue Mar 09 2010 - 10:22:38 EST
>From : Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
When freeing the instruction slot, the arithmetic to calculate the index
of the slot in the page needs to account for the total size of the
instruction on the various architectures.
Calculate the index correctly when freeing the out-of-line execution slot.
Signed-off-by: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Reported-by: Sachin Sant <sachinp@xxxxxxxxxx>
Reported-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---
Index: linux-8mar/kernel/kprobes.c
===================================================================
--- linux-8mar.orig/kernel/kprobes.c 2010-03-08 17:10:33.000000000 +0530
+++ linux-8mar/kernel/kprobes.c 2010-03-08 17:12:12.000000000 +0530
@@ -259,7 +259,8 @@
struct kprobe_insn_page *kip;
list_for_each_entry(kip, &c->pages, list) {
- long idx = ((long)slot - (long)kip->insns) / c->insn_size;
+ long idx = ((long)slot - (long)kip->insns) /
+ (c->insn_size * sizeof(kprobe_opcode_t));
if (idx >= 0 && idx < slots_per_page(c)) {
WARN_ON(kip->slot_used[idx] != SLOT_USED);
if (dirty) {
--
Masami Hiramatsu
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/