bpf: fix short IPv4/IPv6 handling in test_run_skb
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 0 repliesApplied 2/2
- v31 patch 2 repliesSuperseded
Changes in v4 from the cover letter
- Split the selftests into a separate patch.
- Rework the selftest to actually execute a BPF program calling bpf_skb_adjust_room().
- Reuse a single struct ethhdr eth_hlen and initialize h_proto from the test case table.
- Add the Fixes tag to the test_run.c patch.
Patches in v4 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: reject short IPv4/IPv6 inputs in bpf_prog_test_run_skbnet/ | +12 | 0 replies | Applied |
| 2/2 | selftests/bpf: cover short IPv4/IPv6 inputs with adjust_roomtools/ tools/ | +44 | 0 replies | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH bpf v4 0/2] bpf: fix short IPv4/IPv6 handling in test_run_skb
bpf_prog_test_run_skb() may access IPv4/IPv6 network headers based on skb->protocol even when the provided test input only contains an Ethernet header.
Fix it by rejecting such short IPv4/IPv6 inputs before accessing the L3 headers, and add a selftest that exercises the reported bpf_skb_adjust_room() path on ETH_HLEN-sized IPv4/IPv6 EtherType inputs.
Changes in v4:
- Split the selftests into a separate patch.
- Rework the selftest to actually execute a BPF program calling bpf_skb_adjust_room().
- Reuse a single struct ethhdr eth_hlen and initialize h_proto from the test case table.
- Add the Fixes tag to the test_run.c patch.
Sun Jian (2):
bpf: reject short IPv4/IPv6 inputs in bpf_prog_test_run_skb selftests/bpf: cover short IPv4/IPv6 inputs with adjust_room
net/bpf/test_run.c | 20 ++++++---- .../selftests/bpf/prog_tests/empty_skb.c | 40 +++++++++++++++++-- tools/testing/selftests/bpf/progs/empty_skb.c | 7 ++++ 3 files changed, 56 insertions(+), 11 deletions(-)
base-commit: cbfffcca2bf0622b601b7eaf477aa29035169184
Signature · 1 line
2.43.0