Skip to content

bpf: require an owned cpumask for bpf_cpumask_populate()#12759

Closed
kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
bpf-next_basefrom
series/1124896=>bpf-next
Closed

bpf: require an owned cpumask for bpf_cpumask_populate()#12759
kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
bpf-next_basefrom
series/1124896=>bpf-next

Conversation

@kernel-patches-daemon-bpf

Copy link
Copy Markdown

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

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 36ffa86
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: c3d5ef2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: a455304
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: b1d4514
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 30f77a0
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: e821c22
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf
kernel-patches-daemon-bpf Bot force-pushed the series/1124896=>bpf-next branch from 9fae93a to fd21450 Compare July 10, 2026 21:51
@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 77f02c9
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

@kernel-patches-daemon-bpf
kernel-patches-daemon-bpf Bot force-pushed the series/1124896=>bpf-next branch from fd21450 to 39425c4 Compare July 10, 2026 22:02
@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 77f02c9
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1124896
version: 3

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
@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

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

@kernel-patches-daemon-bpf
kernel-patches-daemon-bpf Bot deleted the series/1124896=>bpf-next branch July 11, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant