aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-02-02 16:49:04 -0500
committerIngo Molnar <mingo@elte.hu>2010-02-04 03:36:18 -0500
commit615d0ebbc782b67296e3226c293f520f93f93515 (patch)
tree1831dffd72515695839fc3e99a70976393c4d6c8 /kernel
parent57d818895f9d294ab9080e5a662675fdee943ff1 (diff)
kprobes: Disable booster when CONFIG_PREEMPT=y
Disable kprobe booster when CONFIG_PREEMPT=y at this time, because it can't ensure that all kernel threads preempted on kprobe's boosted slot run out from the slot even using freeze_processes(). The booster on preemptive kernel will be resumed if synchronize_tasks() or something like that is introduced. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <20100202214904.4694.24330.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kprobes.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index b7df302a0204..9907a03c29f6 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -124,30 +124,6 @@ static LIST_HEAD(kprobe_insn_pages);
124static int kprobe_garbage_slots; 124static int kprobe_garbage_slots;
125static int collect_garbage_slots(void); 125static int collect_garbage_slots(void);
126 126
127static int __kprobes check_safety(void)
128{
129 int ret = 0;
130#if defined(CONFIG_PREEMPT) && defined(CONFIG_FREEZER)
131 ret = freeze_processes();
132 if (ret == 0) {
133 struct task_struct *p, *q;
134 do_each_thread(p, q) {
135 if (p != current && p->state == TASK_RUNNING &&
136 p->pid != 0) {
137 printk("Check failed: %s is running\n",p->comm);
138 ret = -1;
139 goto loop_end;
140 }
141 } while_each_thread(p, q);
142 }
143loop_end:
144 thaw_processes();
145#else
146 synchronize_sched();
147#endif
148 return ret;
149}
150
151/** 127/**
152 * __get_insn_slot() - Find a slot on an executable page for an instruction. 128 * __get_insn_slot() - Find a slot on an executable page for an instruction.
153 * We allocate an executable page if there's no room on existing ones. 129 * We allocate an executable page if there's no room on existing ones.
@@ -235,9 +211,8 @@ static int __kprobes collect_garbage_slots(void)
235{ 211{
236 struct kprobe_insn_page *kip, *next; 212 struct kprobe_insn_page *kip, *next;
237 213
238 /* Ensure no-one is preepmted on the garbages */ 214 /* Ensure no-one is interrupted on the garbages */
239 if (check_safety()) 215 synchronize_sched();
240 return -EAGAIN;
241 216
242 list_for_each_entry_safe(kip, next, &kprobe_insn_pages, list) { 217 list_for_each_entry_safe(kip, next, &kprobe_insn_pages, list) {
243 int i; 218 int i;