-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: Check skb->transport_header is set in bpf_skb_check_mtu #6340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Check skb->transport_header is set in bpf_skb_check_mtu #6340
Conversation
|
Upstream branch: 3249e8a |
4eb9670 to
e1b05fd
Compare
|
Upstream branch: f1d8c65 |
51ad6bb to
b029497
Compare
e1b05fd to
b1af442
Compare
|
Upstream branch: 93ce3be |
b029497 to
39dad8b
Compare
b1af442 to
67d3dd3
Compare
|
Upstream branch: 93ce3be |
39dad8b to
3a7dd20
Compare
67d3dd3 to
488318d
Compare
|
Upstream branch: c1da3df |
3a7dd20 to
7bfcc49
Compare
488318d to
728ac5f
Compare
|
Upstream branch: fea3f5e |
7bfcc49 to
061c98a
Compare
728ac5f to
4fcc7e1
Compare
|
Upstream branch: 63066b7 |
061c98a to
8c77721
Compare
4fcc7e1 to
1aeb398
Compare
|
Upstream branch: c133390 |
8c77721 to
5ceb706
Compare
1aeb398 to
f68d848
Compare
|
Upstream branch: ef2c0b2 |
5ceb706 to
33a90d9
Compare
f68d848 to
3fd24de
Compare
|
Upstream branch: a4d31f4 |
33a90d9 to
276477f
Compare
3fd24de to
22f76ea
Compare
The bpf_skb_check_mtu helper needs to use skb->transport_header when the BPF_MTU_CHK_SEGS flag is used: bpf_skb_check_mtu(skb, ifindex, &mtu_len, 0, BPF_MTU_CHK_SEGS) The transport_header is not always set. There is a WARN_ON_ONCE report when CONFIG_DEBUG_NET is enabled + skb->gso_size is set + bpf_prog_test_run is used: WARNING: CPU: 1 PID: 2216 at ./include/linux/skbuff.h:3071 skb_gso_validate_network_len bpf_skb_check_mtu bpf_prog_3920e25740a41171_tc_chk_segs_flag # A test in the next patch bpf_test_run bpf_prog_test_run_skb For a normal ingress skb (not test_run), skb_reset_transport_header is performed but there is plan to avoid setting it as described in commit 2170a1f ("net: no longer reset transport_header in __netif_receive_skb_core()"). This patch fixes the bpf helper by checking skb_transport_header_was_set(). The check is done just before skb->transport_header is used, to avoid breaking the existing bpf prog. The WARN_ON_ONCE is limited to bpf_prog_test_run, so targeting bpf-next. Fixes: 34b2021 ("bpf: Add BPF-helper for MTU checking") Cc: Jesper Dangaard Brouer <[email protected]> Reported-by: Kaiyan Mei <[email protected]> Reported-by: Yinhao Hu <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]>
|
Upstream branch: 4f7bc83 |
…t_header is not set Add a test to check that bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) is rejected (-EINVAL) if skb->transport_header is not set. The test needs to lower the MTU of the loopback device. Thus, take this opportunity to run the test in a netns by adding "ns_" to the test name. The "serial_" prefix can then be removed. Signed-off-by: Martin KaFai Lau <[email protected]>
276477f to
ad86057
Compare
22f76ea to
d766c2f
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1022702 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: Check skb->transport_header is set in bpf_skb_check_mtu
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1022702