-
Notifications
You must be signed in to change notification settings - Fork 6
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: a bug fix and test cases for bpf_skb_change_tail() #4722
Conversation
Upstream branch: 3448ad2 |
8170504
to
bf5cb90
Compare
Upstream branch: 537a252 |
c9feb9f
to
d85186f
Compare
bf5cb90
to
f8fc3a6
Compare
Upstream branch: 537a252 |
d85186f
to
2784f67
Compare
f8fc3a6
to
a55dd53
Compare
Upstream branch: 537a252 |
2784f67
to
d1eb55d
Compare
a55dd53
to
d6e0f06
Compare
Upstream branch: d4c4435 |
d1eb55d
to
87269cf
Compare
d6e0f06
to
9c9d649
Compare
Upstream branch: bd74e23 |
87269cf
to
7c755ad
Compare
9c9d649
to
de5336c
Compare
Upstream branch: bd74e23 |
7c755ad
to
0782cdc
Compare
de5336c
to
1590fbf
Compare
Upstream branch: 5a6ea70 |
0782cdc
to
cb580d0
Compare
1590fbf
to
74f8dce
Compare
Upstream branch: e2cf913 |
cb580d0
to
47057b5
Compare
74f8dce
to
a0d3fba
Compare
Upstream branch: e2cf913 |
47057b5
to
a21111a
Compare
a0d3fba
to
e0813b9
Compare
Upstream branch: 509df67 |
a21111a
to
6825c3b
Compare
e0813b9
to
d73b5d8
Compare
Upstream branch: 509df67 |
6825c3b
to
b4173f6
Compare
d73b5d8
to
e8379c7
Compare
skb_network_offset() and skb_transport_offset() can be negative when they are called after we pull the transport header, for example, when we use eBPF sockmap at the point of ->sk_data_ready(). __bpf_skb_min_len() uses an unsigned int to get these offsets, this leads to a very large number which then causes bpf_skb_change_tail() failed unexpectedly. Fix this by using a signed int to get these offsets and ensure the minimum is at least zero. Fixes: 5293efe ("bpf: add bpf_skb_change_tail helper") Cc: John Fastabend <[email protected]> Cc: Daniel Borkmann <[email protected]> Signed-off-by: Cong Wang <[email protected]>
As requested by Daniel, we need to add a selftest to cover bpf_skb_change_tail() cases in skb_verdict. Here we test trimming, growing and error cases, and validate its expected return values and the expected sizes of the payload. Cc: John Fastabend <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Zijian Zhang <[email protected]> Signed-off-by: Cong Wang <[email protected]>
Pull socket helpers out of sockmap_helpers.h so that they can be reused for TC tests as well. This prepares for the next patch. Cc: John Fastabend <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Zijian Zhang <[email protected]> Signed-off-by: Cong Wang <[email protected]>
Similarly to the previous test, we also need a test case to cover positive offsets as well, TC is an excellent hook for this. Cc: John Fastabend <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Zijian Zhang <[email protected]> Signed-off-by: Cong Wang <[email protected]>
Upstream branch: 509df67 |
b4173f6
to
f3b08dc
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=913222 expired. Closing PR. |
Pull request for series with
subject: bpf: a bug fix and test cases for bpf_skb_change_tail()
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=913222