Re: [PATCH bpf-next] exec: Drop bprm loader before closing bprm->file
From: Christian Brauner
Date: Thu Sep 03 2026 - 03:38:11 EST
On Tue, 01 Sep 2026 04:40:11 -0700, Sun Jian wrote:
> free_bprm() currently drops what may be the final reference to
> bprm->file before calling bprm_drop_loader(). Since
> bprm_drop_loader() is attachable via BPF fentry and bprm->file is
> exposed as a BTF_TYPE_SAFE_TRUSTED pointer, the file can be observed
> after its reference has been released.
>
> Move bprm_drop_loader() before do_close_execat(bprm->file), keeping
> the file reference held while the hook runs. This preserves the
> existing trusted BTF contract without changing verifier behavior.
>
> [...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] exec: Drop bprm loader before closing bprm->file
https://git.kernel.org/vfs/vfs/c/115bf3e51538