-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: verifier: refactor bpf_wq handling #6101
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 #6101
Conversation
|
Upstream branch: de73422 |
|
This is a test comment. In-Reply-To-Subject: |
|
Forwarding comment 3374374135 via email |
|
Forwarding comment 3374374135 via email |
|
Forwarding comment 3374374135 via email |
|
Forwarding comment 3374374135 via email |
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 <yatsenko@meta.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com>
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 <yatsenko@meta.com> Tested-by: Eduard Zingerman <eddyz87@gmail.com>
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 <yatsenko@meta.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
|
Upstream branch: de73422 |
a4367c6 to
63505f8
Compare
|
This is another test comment. In-Reply-To-Subject: |
|
Forwarding comment 3374704248 via email |
Pull request for series with
subject: bpf: verifier: refactor bpf_wq handling
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1008788