Re: [PATCH 6.6.y 1/2] bpf: put uprobe link's path and task in release callback

Greg KH
2024-04-08T11:41:39Z

On Fri, Apr 05, 2024 at 09:38:05AM -0700, Andrii Nakryiko wrote:
> 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>
> (cherry picked from commit e9c856cabefb71d47b2eeb197f72c9c88e9b45b0)
> ---
> kernel/trace/bpf_trace.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

All now queued up, thanks.

greg k-h