Skip to contentSkip to conversation

Refuse inserting kprobe on slot 1

PATCH In review Rusty Lynch 2 participants 2 messages Jun 23, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Refuse inserting kprobe on slot 1

Without the ability to atomically write 16 bytes, we can not update the middle slot of a bundle, slot 1, unless we stop the machine first. This patch will ensure the ability to robustly insert and remove a kprobe by refusing to insert a kprobe on slot 1 until a mechanism is in place to safely handle this case.

	--rusty
 arch/ia64/kernel/kprobes.c |    7 +++++++
 1 files changed, 7 insertions(+)

Index: linux-2.6.12-mm1/arch/ia64/kernel/kprobes.c =================================--- linux-2.6.12-mm1.orig/arch/ia64/kernel/kprobes.c +++ linux-2.6.12-mm1/arch/ia64/kernel/kprobes.c
@@ -270,6 +270,13 @@ static int valid_kprobe_addr(int templat
addr);
return -EINVAL;
}
+
+ if (slot = 1) {
+ printk(KERN_WARNING "Inserting kprobes on slot #1 "
+ "is not supported\n");
+ return -EINVAL;
+ }
+
return 0;
}

#1 lore raw
Quoted 3 lines · Rusty Lynch

+
+ if (slot = 1) {

Rusty, this is wrong. You should fail only

	if (slot = 1) && (bundle_encoding[template][1] != L) {

This is because for MLX template we will actually be patching the instruction on slot = 2 and not on slot 1.

Quoted 8 lines

+ printk(KERN_WARNING "Inserting kprobes on slot #1 "

   +                      "is not supported\n");
   +               return -EINVAL;
   +       }
   +
           return 0;
    }

-Anil