-
Notifications
You must be signed in to change notification settings - Fork 5
Support non-linear skbs for BPF_PROG_TEST_RUN #6083
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
Support non-linear skbs for BPF_PROG_TEST_RUN #6083
Conversation
|
Upstream branch: 4ef77dd |
5d00461 to
c395c15
Compare
|
Upstream branch: 4ef77dd |
540bd87 to
6539330
Compare
c395c15 to
e0b1dc1
Compare
|
Upstream branch: cbf33b8 |
6539330 to
f6f6563
Compare
e0b1dc1 to
ce3f403
Compare
|
Upstream branch: de73422 |
f6f6563 to
a9839b3
Compare
ce3f403 to
879ec96
Compare
|
Upstream branch: 2486138 |
a9839b3 to
778e971
Compare
879ec96 to
2a180ed
Compare
This bit of refactoring aims to simplify how we free memory in bpf_prog_test_run_skb to avoid code duplication. Tested-by: [email protected] Signed-off-by: Paul Chaignon <[email protected]>
This patch reorders the initialization of bpf_prog_test_run_skb to simplify the subsequent patch. Program types are checked first, followed by the ctx init, and finally the data init. With the subsequent patch, program types and the ctx init provide information that is used in the data init. Thus, we need the data init to happen last. Signed-off-by: Paul Chaignon <[email protected]>
This patch adds support for crafting non-linear skbs in BPF test runs for tc programs. The size of the linear area is given by ctx->data_end, with a minimum of ETH_HLEN always pulled in the linear area. If ctx or ctx->data_end are null, a linear skb is used. This is particularly useful to test support for non-linear skbs in large codebases such as Cilium. We've had multiple bugs in the past few years where we were missing calls to bpf_skb_pull_data(). This support in BPF_PROG_TEST_RUN would allow us to automatically cover this case in our BPF tests. In addition to the selftests introduced later in the series, this patch was tested by setting enabling non-linear skbs for all tc selftests programs and checking test failures were expected. Tested-by: [email protected] Suggested-by: Daniel Borkmann <[email protected]> Signed-off-by: Paul Chaignon <[email protected]>
This patch adds support for a new tag __linear_size in the test loader, to specify the size of the linear area in case of non-linear skbs. If the tag is absent or null, a linear skb is crafted. Signed-off-by: Paul Chaignon <[email protected]>
|
Upstream branch: de73422 |
This patch adds new selftests in the direct packet access suite, to cover the non-linear case. The three first tests cover the behavior of the bounds check with a non-linear skb (first two with min. linear size, third with long enough linear size). The last test adds a call to bpf_skb_pull_data() to be able to access the packet. Signed-off-by: Paul Chaignon <[email protected]>
778e971 to
5e52509
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1007970 expired. Closing PR. |
Pull request for series with
subject: Support non-linear skbs for BPF_PROG_TEST_RUN
version: 5
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1007970