[PATCH bpf-next v3 0/3] bpf: Check tail zero of bpf_map_info and bpf_prog_info
From: Leon Hwang
Date: Fri Jun 05 2026 - 12:12:18 EST
Check the tail bytes of bpf_map_info and bpf_prog_info due to padding
when getting map info and prog info via BPF_OBJ_GET_INFO_BY_FD, which
was discussed in the thread
"bpf: Check tail zero of bpf_common_attr using offsetofend" [1].
Links:
[1] https://lore.kernel.org/bpf/20260518145446.6794-2-leon.hwang@xxxxxxxxx/
Changes:
v2 -> v3:
* Add "__u32 :32" to bpf_map_info and bpf_prog_info (per Alexei).
* v2: https://lore.kernel.org/bpf/20260604150505.99129-1-leon.hwang@xxxxxxxxx/
v1 -> v2:
* Collect Acked-by tags from Mykyta, thanks.
* Update Fixes tag in patch #2 (per bot+bpf-ci)
* v1: https://lore.kernel.org/bpf/20260603144518.67065-1-leon.hwang@xxxxxxxxx/
Leon Hwang (3):
bpf: Check tail zero of bpf_map_info
bpf: Check tail zero of bpf_prog_info
selftests/bpf: Add tests to verify checking padding bytes for
bpf_[map,prog]_info
include/uapi/linux/bpf.h | 2 +
kernel/bpf/syscall.c | 10 ++--
tools/include/uapi/linux/bpf.h | 2 +
.../selftests/bpf/prog_tests/bpf_attr_size.c | 55 +++++++++++++++++++
4 files changed, 65 insertions(+), 4 deletions(-)
--
2.54.0