]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Fix a verifier verbose message
authorAnton Protopopov <aspsk@isovalent.com>
Fri, 12 Apr 2024 14:11:00 +0000 (16:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:26 +0000 (12:14 +0200)
commit95d76d6a4d8917ce5127a9fa11afde8b6fe3f03a
treeefefe780088b1f95aa74fafb5921ca5d5894462f
parent5bb8c1b047d30126fe44f0a37293b0445eef0f58
bpf: Fix a verifier verbose message

[ Upstream commit 37eacb9f6e89fb399a79e952bc9c78eb3e16290e ]

Long ago a map file descriptor in a pseudo ldimm64 instruction could
only be present as an immediate value insn[0].imm, and thus this value
was used in a verbose verifier message printed when the file descriptor
wasn't valid. Since addition of BPF_PSEUDO_MAP_IDX_VALUE/BPF_PSEUDO_MAP_IDX
the insn[0].imm field can also contain an index pointing to the file
descriptor in the attr.fd_array array. However, if the file descriptor
is invalid, the verifier still prints the verbose message containing
value of insn[0].imm. Patch the verifier message to always print the
actual file descriptor value.

Fixes: 387544bfa291 ("bpf: Introduce fd_idx")
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240412141100.3562942-1-aspsk@isovalent.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/verifier.c