bpf: fix possible file descriptor leaks in verifier
PATCH v2 1/1 bpf: fix possible file descriptor leaks in verifier
The resolve_pseudo_ldimm64() function might have leaked file descriptors when BPF_MAP_TYPE_ARENA was used in a program (some error paths missed a corresponding fdput). Add missing fdputs.
v2:
remove unrelated changes from the fix
--- kernel/bpf/verifier.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/verifier.c +3 -0
@@ -18383,15 +18383,18 @@ static int resolve_pseudo_ldimm64(struct bpf_verifier_env *env) }if (!env->prog->jit_requested) {verbose (env,"JIT is required to use arena\n" ); +fdput (f);return -EOPNOTSUPP ; }if (!bpf_jit_supports_arena ()) {verbose (env,"JIT doesn't support arena\n" ); +fdput (f);return -EOPNOTSUPP ; } env->prog->aux->arena = (void *)map;if (!bpf_arena_get_user_vm_start (env->prog->aux->arena)) {verbose (env,"arena's user address must be set via map_extra or mmap()\n" ); +fdput (f);return -EINVAL ; } }
Signature · 1 line
2.34.1
Quoted 9 lines · Anton Protopopov
The
resolve_pseudo_ldimm64()function might have leaked file descriptors whenBPF_MAP_TYPE_ARENAwas used in a program (some error paths missed a corresponding fdput). Add missing fdputs.v2:
remove unrelated changes from the fixFixes 6082b6c328b5 ("bpf: Recognize addr_space_cast instruction in the verifier.")Signed-off-by Anton Protopopov <[email protected]>
Thanks for the dedicated patch for the bug fix. LGTM.
Quoted 9 lines · Anton Protopopov
The
resolve_pseudo_ldimm64()function might have leaked file descriptors whenBPF_MAP_TYPE_ARENAwas used in a program (some error paths missed a corresponding fdput). Add missing fdputs.v2:
remove unrelated changes from the fixFixes 6082b6c328b5 ("bpf: Recognize addr_space_cast instruction in the verifier.")Signed-off-by Anton Protopopov <[email protected]>
This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 8 lines · On Fri, 29 Mar 2024 07:11:06 +0000 you wrote:
The
resolve_pseudo_ldimm64()function might have leaked file descriptors whenBPF_MAP_TYPE_ARENAwas used in a program (some error paths missed a corresponding fdput). Add missing fdputs.v2:
remove unrelated changes from the fix[...]
Here is the summary with links:
- [v2,bpf-next] bpf: fix possible file descriptor leaks in verifier
https://git.kernel.org/bpf/bpf/c/6dae957c8eef
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html