diff options
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 134754d18bb4..531e10164836 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -480,8 +480,6 @@ static DECLARE_COMPLETION(optimizer_comp); | |||
480 | */ | 480 | */ |
481 | static __kprobes void do_optimize_kprobes(void) | 481 | static __kprobes void do_optimize_kprobes(void) |
482 | { | 482 | { |
483 | struct optimized_kprobe *op, *tmp; | ||
484 | |||
485 | /* Optimization never be done when disarmed */ | 483 | /* Optimization never be done when disarmed */ |
486 | if (kprobes_all_disarmed || !kprobes_allow_optimization || | 484 | if (kprobes_all_disarmed || !kprobes_allow_optimization || |
487 | list_empty(&optimizing_list)) | 485 | list_empty(&optimizing_list)) |
@@ -499,12 +497,7 @@ static __kprobes void do_optimize_kprobes(void) | |||
499 | */ | 497 | */ |
500 | get_online_cpus(); | 498 | get_online_cpus(); |
501 | mutex_lock(&text_mutex); | 499 | mutex_lock(&text_mutex); |
502 | list_for_each_entry_safe(op, tmp, &optimizing_list, list) { | 500 | arch_optimize_kprobes(&optimizing_list); |
503 | WARN_ON(kprobe_disabled(&op->kp)); | ||
504 | if (arch_optimize_kprobe(op) < 0) | ||
505 | op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED; | ||
506 | list_del_init(&op->list); | ||
507 | } | ||
508 | mutex_unlock(&text_mutex); | 501 | mutex_unlock(&text_mutex); |
509 | put_online_cpus(); | 502 | put_online_cpus(); |
510 | } | 503 | } |
@@ -598,8 +591,12 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) | |||
598 | mutex_unlock(&kprobe_mutex); | 591 | mutex_unlock(&kprobe_mutex); |
599 | mutex_unlock(&module_mutex); | 592 | mutex_unlock(&module_mutex); |
600 | 593 | ||
601 | /* Wake up all waiters */ | 594 | /* Step 5: Kick optimizer again if needed */ |
602 | complete_all(&optimizer_comp); | 595 | if (!list_empty(&optimizing_list)) |
596 | kick_kprobe_optimizer(); | ||
597 | else | ||
598 | /* Wake up all waiters */ | ||
599 | complete_all(&optimizer_comp); | ||
603 | } | 600 | } |
604 | 601 | ||
605 | /* Wait for completing optimization and unoptimization */ | 602 | /* Wait for completing optimization and unoptimization */ |