]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Mask pseudo pointer values in verifier logs
authorNuoqi Gui <gnq25@mails.tsinghua.edu.cn>
Tue, 23 Jun 2026 10:43:38 +0000 (18:43 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Jun 2026 00:59:04 +0000 (17:59 -0700)
commit72a85e9464a5332fb2cd7efd26d9295275ceda2d
treed0383f45520fb99e1c9e18d834e46cc73cd0d027
parentfbc10dff7846206585b02864fef4ebfd7cadf6e2
bpf: Mask pseudo pointer values in verifier logs

print_bpf_insn() masks ldimm64 immediates for pointer-bearing pseudo
sources when pointer leaks are not allowed, but the mask only covers
BPF_PSEUDO_MAP_FD and BPF_PSEUDO_MAP_VALUE.

BPF_PSEUDO_MAP_IDX, BPF_PSEUDO_MAP_IDX_VALUE, and BPF_PSEUDO_BTF_ID can
also be resolved to kernel pointer values before the verifier log prints
the instruction. Include them in the existing pointer classification so
the log prints 0x0 instead of the rewritten address.

Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
Fixes: 387544bfa291 ("bpf: Introduce fd_idx")
Signed-off-by: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
Link: https://lore.kernel.org/r/20260623-f01-13-pseudo-btf-id-cap-bpf-v2-1-a190ebb8f3e2@mails.tsinghua.edu.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
kernel/bpf/disasm.c