-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: verifier: refactor bpf_wq handling #6107
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: verifier: refactor bpf_wq handling #6107
Conversation
Upstream branch: de73422 |
2a180ed
to
22821ea
Compare
Upstream branch: 0db4941 |
9ce7178
to
9b00fa5
Compare
22821ea
to
3bfc6dc
Compare
Upstream branch: 56b4d16 |
9b00fa5
to
e01fe4b
Compare
3bfc6dc
to
78417cf
Compare
Upstream branch: 56b4d16 |
e01fe4b
to
a93f55c
Compare
78417cf
to
cdcea0f
Compare
Upstream branch: 56b4d16 |
a93f55c
to
706d165
Compare
cdcea0f
to
5ba1e72
Compare
Move bpf_wq map-field validation into the common helper by adding a BPF_WORKQUEUE case that maps to record->wq_off, and switch process_wq_func() to use it instead of doing its own offset math. Fix handling maps with no BTF and non-constant offsets for the bpf_wq. This de-duplicates logic with other internal structs (task_work, timer), keeps error reporting consistent, and makes future changes to the layout handling centralized. Fixes: d940c9b ("bpf: add support for KF_ARG_PTR_TO_WORKQUEUE") Signed-off-by: Mykyta Yatsenko <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
Add bpf_wq selftests to verify: * BPF program using non-constant offset of struct bpf_wq is rejected * BPF program using map with no BTF for storing struct bpf_wq is rejected Signed-off-by: Mykyta Yatsenko <[email protected]> Tested-by: Eduard Zingerman <[email protected]>
arraymap and hashtab duplicate the logic that checks for and frees internal structs (timer, workqueue, task_work) based on BTF record flags. Centralize this by introducing two helpers: * bpf_map_has_internal_structs(map) Returns true if the map value contains any of internal structs: BPF_TIMER | BPF_WORKQUEUE | BPF_TASK_WORK. * bpf_map_free_internal_structs(map, obj) Frees the internal structs for a single value object. Convert arraymap and both the prealloc/malloc hashtab paths to use the new generic functions. This keeps the functionality for when/how to free these special fields in one place and makes it easier to add support for new internal structs in the future without touching every map implementation. Signed-off-by: Mykyta Yatsenko <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
Upstream branch: 56b4d16 |
706d165
to
7542778
Compare
Pull request for series with
subject: bpf: verifier: refactor bpf_wq handling
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1009123