aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kprobes.c')
-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;