Re: [PATCH bpf] bpf: Fix program BTF use-after-free in sleepable programs

From: patchwork-bot+netdevbpf

Date: Fri Sep 11 2026 - 13:52:10 EST


Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@xxxxxxxxxx>:

On Tue, 1 Sep 2026 10:48:29 +0900 you wrote:
> Object kfunc calls embed metadata owned by the program BTF. A sleepable
> program can remain active under Tasks Trace RCU after its last reference is
> dropped, while program teardown releases the BTF through ordinary RCU. The
> invocation can then dereference freed metadata in bpf_obj_new().
>
> Move btf_put() into __bpf_prog_put_rcu(), the callback that frees the
> program. When teardown is deferred, that callback runs after the program's
> own grace period (Tasks Trace RCU for sleepable programs and ordinary RCU
> otherwise), so the BTF outlives every active invocation. The non-deferred
> path invokes the callback synchronously, so load-error cleanup stays direct.
>
> [...]

Here is the summary with links:
- [bpf] bpf: Fix program BTF use-after-free in sleepable programs
https://git.kernel.org/bpf/bpf-next/c/88c9c6d0a766

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html