Skip to content
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 negative offsets in __bpf_skb_min_len() #4621

Closed
wants to merge 2 commits into from

Conversation

kernel-patches-daemon-bpf-rc[bot]
Copy link

Pull request for series with
subject: bpf: check negative offsets in __bpf_skb_min_len()
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 44d0469
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 44d0469
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: fb86c42
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: fb86c42
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 9f8e716
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 9f8e716
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: adc2186
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: adc2186
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: adc2186
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 20a39ea
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: ef3ba8c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 6b64128
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 6b64128
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 3448ad2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 3448ad2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

Cong Wang added 2 commits November 26, 2024 14:16
skb_transport_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 (aka 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.

Cc: John Fastabend <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Zijian Zhang <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 3448ad2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=907189
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=907189 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants