Skip to content

bpf: Follow-up fixes for BPF syscall common attributes

Leon Hwang bpf linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 9 repliesIn review 4 of 5 applied

Patches in v1 4 of 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: Check tail zero of bpf_common_attr using offsetofendkernel/bpf/syscall.c+3 -12 repliesApplied
2/5bpf: Fix concurrent regression in map_create()kernel/bpf/syscall.c+11 -47 replies
3/5libbpf: Add OPTS_VALID() for log_opts in bpf_map_createtools/lib/bpf/bpf.c+3 -00 repliesApplied
4/5selftests/bpf: Use -1 as token_fd in map create failure testtools/testing/selftests/bpf/prog_tests/map_init.c+1 -10 repliesApplied
5/5selftests/bpf: Add test to verify checking padding bytes for BPF syscall common attributestools/testing/selftests/bpf/prog_tests/map_init.c+26 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/5] bpf: Follow-up fixes for BPF syscall common attributes

Address sashiko reviews for BPF syscall common attributes series.

1. The tailing padding bytes in struct bpf_common_attr should be checked. [1]
2. There was a concurrent regression in syscall.c::map_create(). [2]
3. OPTS_VALID() was missing to validate the nested struct bpf_log_opts in libbpf. [3]
4. The token_fd should be -1 to avoid a valid token fd in test. [4]

A test is added to verify the fix #1.

The fix #2 is hard to be verified by test. So, I decide not to add a test for it to avoid over-engineering.

Decide not to add a test for fix #3 to avoid over-engineering, as the fix looks really simple.

Links:
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/bpf/[email protected]/
[3] https://lore.kernel.org/bpf/[email protected]/
[4] https://lore.kernel.org/bpf/[email protected]/

Leon Hwang (5):
bpf: Check tail zero of bpf_common_attr using offsetofend
bpf: Fix concurrent regression in map_create()
libbpf: Add OPTS_VALID() for log_opts in bpf_map_create selftests/bpf: Use -1 as token_fd in map create failure test selftests/bpf: Add test to verify checking padding bytes for BPF
syscall common attributes

 kernel/bpf/syscall.c                          | 19 +++++++++----
 tools/lib/bpf/bpf.c                           |  3 ++
 .../selftests/bpf/prog_tests/map_init.c       | 28 ++++++++++++++++++-
 3 files changed, 44 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0