]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: put uprobe link's path and task in release callback
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 28 Mar 2024 05:24:25 +0000 (22:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:36:06 +0000 (16:36 +0200)
commit771690b7c31d6ef210f94587e6562f445d7b438d
treed1888dc9cab9af831fe5f842ee8a02d12e4e75fb
parent43eca11b7c73030deb2034f33e9dc6a91fe56c23
bpf: put uprobe link's path and task in release callback

commit e9c856cabefb71d47b2eeb197f72c9c88e9b45b0 upstream.

There is no need to delay putting either path or task to deallocation
step. It can be done right after bpf_uprobe_unregister. Between release
and dealloc, there could be still some running BPF programs, but they
don't access either task or path, only data in link->uprobes, so it is
safe to do.

On the other hand, doing path_put() in dealloc callback makes this
dealloc sleepable because path_put() itself might sleep. Which is
problematic due to the need to call uprobe's dealloc through call_rcu(),
which is what is done in the next bug fix patch. So solve the problem by
releasing these resources early.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240328052426.3042617-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/bpf_trace.c