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

libbpf: Use OPTS_SET() macro in bpf_xdp_query() #6405

Closed

Conversation

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

Pull request for series with
subject: libbpf: Use OPTS_SET() macro in bpf_xdp_query()
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=823571

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 563918a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=823571
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

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

When the feature_flags and xdp_zc_max_segs fields were added to the libbpf
bpf_xdp_query_opts, the code writing them did not use the OPTS_SET() macro.
This causes libbpf to write to those fields unconditionally, which means
that programs compiled against an older version of libbpf (with a smaller
size of the bpf_xdp_query_opts struct) will have its stack corrupted by
libbpf writing out of bounds.

The patch adding the feature_flags field has an early bail out if the
feature_flags field is not part of the opts struct (via the OPTS_HAS)
macro, but the patch adding xdp_zc_max_segs does not. For consistency, this
fix just changes the assignments to both fields to use the OPTS_SET()
macro.

Fixes: 13ce2da ("xsk: add new netlink attribute dedicated for ZC max frags")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/823571=>bpf-next branch February 6, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant