bpf: require an owned cpumask for bpf_cpumask_populate()#12759
bpf: require an owned cpumask for bpf_cpumask_populate()#12759kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
Conversation
|
Upstream branch: 36ffa86 |
f42b070 to
76af7b1
Compare
|
Upstream branch: c3d5ef2 |
7738eee to
2af5f51
Compare
76af7b1 to
294813d
Compare
|
Upstream branch: a455304 |
2af5f51 to
80fa1a3
Compare
294813d to
3d40a7b
Compare
|
Upstream branch: b1d4514 |
80fa1a3 to
7c4c6e6
Compare
3d40a7b to
320974b
Compare
|
Upstream branch: 30f77a0 |
7c4c6e6 to
9fae93a
Compare
320974b to
a8517a2
Compare
|
Upstream branch: e821c22 |
9fae93a to
fd21450
Compare
a8517a2 to
386cc3c
Compare
|
Upstream branch: 77f02c9 |
fd21450 to
39425c4
Compare
|
Upstream branch: 77f02c9 |
bpf_cpumask_populate() writes to its destination with bitmap_copy(), but the destination is typed as struct cpumask *. That allows the verifier to accept borrowed cpumask pointers returned by read-only kfuncs, such as scx_bpf_get_online_cpumask(), as a writable destination. Make the destination a struct bpf_cpumask * so populate follows the same ownership rule as the other mutating cpumask kfuncs. Query kfuncs continue to accept const struct cpumask * inputs. Fixes: 950ad93 ("bpf: add kfunc for populating cpumask bits") Signed-off-by: Nicholas Dudar <main.kalliope@gmail.com> Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
bpf_cpumask_populate() now takes a struct bpf_cpumask *, so update the kfunc declaration and drop the struct cpumask * casts in the existing populate tests. Add test_populate_borrowed_destination, which passes a borrowed task->cpus_ptr and asserts the verifier rejects it as a writable destination. Signed-off-by: Nicholas Dudar <main.kalliope@gmail.com> Assisted-by: Claude:claude-opus-4-8
39425c4 to
7ea8159
Compare
386cc3c to
ded8f8a
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: require an owned cpumask for bpf_cpumask_populate()
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896