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: handle nulled-out program in struct_ops correctly #6901

Closed

Conversation

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

Pull request for series with
subject: libbpf: handle nulled-out program in struct_ops correctly
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=848574

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 07801a2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=848574
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 89de2db
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=848574
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 0db63c0
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=848574
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 789d9a5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=848574
version: 1

If struct_ops has one of program callbacks set declaratively and host
kernel is old and doesn't support this callback, libbpf will allow to
load such struct_ops as long as that callback was explicitly nulled-out
(presumably through skeleton). This is all working correctly, except we
won't reset corresponding program slot to NULL before bailing out, which
will lead to libbpf not detecting that BPF program has to be not
auto-loaded. Fix this by unconditionally resetting corresponding program
slot to NULL.

Fixes: c911fc6 ("libbpf: Skip zeroed or null fields if not found in the kernel type.")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
…erly

Add a selftests validating that it's possible to have some struct_ops
callback set declaratively, then disable it (by setting to NULL)
programmatically. Libbpf should detect that such program should be
loaded, even if host kernel doesn't have type information for it.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

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

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