|
@@ -124,30 +124,6 @@ static LIST_HEAD(kprobe_insn_pages);
|
|
|
static int kprobe_garbage_slots;
|
|
|
static int collect_garbage_slots(void);
|
|
|
|
|
|
-static int __kprobes check_safety(void)
|
|
|
-{
|
|
|
- int ret = 0;
|
|
|
-#if defined(CONFIG_PREEMPT) && defined(CONFIG_FREEZER)
|
|
|
- ret = freeze_processes();
|
|
|
- if (ret == 0) {
|
|
|
- struct task_struct *p, *q;
|
|
|
- do_each_thread(p, q) {
|
|
|
- if (p != current && p->state == TASK_RUNNING &&
|
|
|
- p->pid != 0) {
|
|
|
- printk("Check failed: %s is running\n",p->comm);
|
|
|
- ret = -1;
|
|
|
- goto loop_end;
|
|
|
- }
|
|
|
- } while_each_thread(p, q);
|
|
|
- }
|
|
|
-loop_end:
|
|
|
- thaw_processes();
|
|
|
-#else
|
|
|
- synchronize_sched();
|
|
|
-#endif
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* __get_insn_slot() - Find a slot on an executable page for an instruction.
|
|
|
* We allocate an executable page if there's no room on existing ones.
|
|
@@ -235,9 +211,8 @@ static int __kprobes collect_garbage_slots(void)
|
|
|
{
|
|
|
struct kprobe_insn_page *kip, *next;
|
|
|
|
|
|
- /* Ensure no-one is preepmted on the garbages */
|
|
|
- if (check_safety())
|
|
|
- return -EAGAIN;
|
|
|
+ /* Ensure no-one is interrupted on the garbages */
|
|
|
+ synchronize_sched();
|
|
|
|
|
|
list_for_each_entry_safe(kip, next, &kprobe_insn_pages, list) {
|
|
|
int i;
|