BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate()
@ 2026-07-09 18:27 Nicholas Dudar
  2026-07-09 18:27 ` [PATCH bpf-next v3 1/2] bpf: Require a BPF " Nicholas Dudar
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Nicholas Dudar @ 2026-07-09 18:27 UTC (permalink / raw)
  To: ast, daniel, andrii, eddyz87, memxor
  Cc: tj, void, arighi, changwoo, bpf, sched-ext

bpf_cpumask_populate() writes its destination with bitmap_copy() but
types it as struct cpumask *, so the verifier accepts a borrowed,
read-only cpumask (for example from scx_bpf_get_online_cpumask()) as a
writable destination. Fix it and add a selftest for coverage.

Changelog:
----------
v2 -> v3 (v1/v2 were a private report to security@kernel.org)

 * Split the fix and selftest into separate patches.
 * Target bpf-next instead of bpf.

Nicholas Dudar (2):
  bpf: Require a BPF cpumask for bpf_cpumask_populate()
  selftests/bpf: test bpf_cpumask_populate() rejects a borrowed cpumask

 kernel/bpf/cpumask.c                          |  6 ++---
 tools/sched_ext/include/scx/compat.bpf.h      |  2 +-
 .../selftests/bpf/progs/cpumask_common.h      |  2 +-
 .../selftests/bpf/progs/cpumask_failure.c     | 23 +++++++++++++++++--
 .../selftests/bpf/progs/cpumask_success.c     |  6 ++---
 5 files changed, 29 insertions(+), 10 deletions(-)


base-commit: 36ffa86c42f91c8a57071e024afc4ffb51a8958f
-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-07-11 23:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 18:27 [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate() Nicholas Dudar
2026-07-09 18:27 ` [PATCH bpf-next v3 1/2] bpf: Require a BPF " Nicholas Dudar
2026-07-09 18:39   ` sashiko-bot
2026-07-10 19:18     ` Kumar Kartikeya Dwivedi
2026-07-10 20:17       ` Admin
2026-07-10 20:34         ` Kumar Kartikeya Dwivedi
2026-07-10 23:43           ` Emil Tsalapatis
2026-07-10 23:42   ` Emil Tsalapatis
2026-07-09 18:28 ` [PATCH bpf-next v3 2/2] selftests/bpf: test bpf_cpumask_populate() rejects a borrowed cpumask Nicholas Dudar
2026-07-10 23:51   ` Emil Tsalapatis
2026-07-10 19:17 ` [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate() Kumar Kartikeya Dwivedi
2026-07-11 23:38   ` Tejun Heo
2026-07-11  0:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox