[PATCH bpf-next 0/3] properly load insn array values with offsets

Anton Protopopov
2026-01-11T15:23:08Z

As was reported by the BPF CI bot in [1] the direct address
of an instruction array returned by map_direct_value_addr()
is incorrect if the offset is non-zero. Fix this bug and
add selftests.

Also (commit 2), return EACCES instead of EINVAL when offsets
aren't correct.

[1] https://lore.kernel.org/bpf/0447c47ac58306546a5dbdbad2601f3e77fa8eb24f3a4254dda3a39f6133e68f@mail.kernel.org/

Anton Protopopov (3):
bpf: insn array: return proper address for non-zero offsets
bpf: insn array: return EACCES for incorrect map access
selftests/bpf: add tests for loading map values with offsets

kernel/bpf/bpf_insn_array.c | 4 +-
.../selftests/bpf/prog_tests/bpf_gotox.c | 208 ++++++++++++++++++
2 files changed, 210 insertions(+), 2 deletions(-)

--
2.34.1