Thread (3 messages) 3 messages, 3 authors, 2024-01-18

Re: [PATCH] kprobes: Use synchronize_rcu_tasks_rude in kprobe_optimizer

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2024-01-17 20:31:39
Also in: lkml

On Wed, 17 Jan 2024 06:16:36 +0000 Chen Zhongjin [off-list ref] wrote:
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.

Signed-off-by: Chen Zhongjin <redacted>
Thanks.  Should we backport this fix into earlier kernels?  If so, are
we able to identify a suitable Fixes: target?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help