The quilt patch titled Subject: kprobes: use synchronize_rcu_tasks_rude in kprobe_optimizer has been removed from the -mm tree. Its filename was kprobes-use-synchronize_rcu_tasks_rude-in-kprobe_optimizer.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Chen Zhongjin <chenzhongjin@xxxxxxxxxx> Subject: kprobes: use synchronize_rcu_tasks_rude in kprobe_optimizer Date: Wed, 17 Jan 2024 06:16:36 +0000 There is a deadlock scenario in kprobe_optimizer(): pid A pid B pid C kprobe_optimizer() do_exit() perf_kprobe_init() mutex_lock(&kprobe_mutex) exit_tasks_rcu_start() mutex_lock(&kprobe_mutex) synchronize_rcu_tasks() zap_pid_ns_processes() // waiting kprobe_mutex // waiting tasks_rcu_exit_srcu kernel_wait4() // waiting pid C exit To avoid this deadlock loop, use synchronize_rcu_tasks_rude() in kprobe_optimizer() rather than synchronize_rcu_tasks(). synchronize_rcu_tasks_rude() can also promise that all preempted tasks have scheduled, but it will not wait tasks_rcu_exit_srcu. [akpm@xxxxxxxxxxxxxxxxxxxx: unrelated comment typo fix] Link: https://lkml.kernel.org/r/20240117061636.288412-1-chenzhongjin@xxxxxxxxxx Fixes: a30b85df7d59 ("kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y") Signed-off-by: Chen Zhongjin <chenzhongjin@xxxxxxxxxx> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@xxxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Douglas Anderson <dianders@xxxxxxxxxxxx> Cc: Eric DeVolder <eric.devolder@xxxxxxxxxx> Cc: Jakob Koschel <jkl820.git@xxxxxxxxx> Cc: Juerg Haefliger <juerg.haefliger@xxxxxxxxxxxxx> Cc: "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc) Cc: Mickaël Salaün <mic@xxxxxxxxxxx> Cc: "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Paul E. McKenney <paulmck@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Yang Jihong <yangjihong1@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/Kconfig | 2 +- kernel/kprobes.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/arch/Kconfig~kprobes-use-synchronize_rcu_tasks_rude-in-kprobe_optimizer +++ a/arch/Kconfig @@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST config OPTPROBES def_bool y depends on KPROBES && HAVE_OPTPROBES - select TASKS_RCU if PREEMPTION + select TASKS_RUDE_RCU config KPROBES_ON_FTRACE def_bool y --- a/kernel/kprobes.c~kprobes-use-synchronize_rcu_tasks_rude-in-kprobe_optimizer +++ a/kernel/kprobes.c @@ -621,9 +621,9 @@ static void kprobe_optimizer(struct work * instruction is preempted. In that case, such tasks can return * to 2nd-Nth byte of jump instruction. This wait is for avoiding it. * Note that on non-preemptive kernel, this is transparently converted - * to synchronoze_sched() to wait for all interrupts to have completed. + * to synchronize_sched() to wait for all interrupts to have completed. */ - synchronize_rcu_tasks(); + synchronize_rcu_tasks_rude(); /* Step 3: Optimize kprobes after quiesence period */ do_optimize_kprobes(); _ Patches currently in -mm which might be from chenzhongjin@xxxxxxxxxx are