Skip to content

bpf: require an owned cpumask for bpf_cpumask_populate()

Nicholas Dudar bpf sashiko-reviews sched-ext 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest2 patches 8 repliesApplied 2/2

Changes in v3 from the cover letter

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

Patches in v3 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Require a BPF cpumask for bpf_cpumask_populate()kernel/bpf/cpumask.c tools/sched_ext/include/scx/compat.bpf.h+4 -45 repliesApplied
2/2selftests/bpf: test bpf_cpumask_populate() rejects a borrowed cpumasktools/testing/selftests/bpf/progs/cpumask_common.h tools/testing/selftests/bpf/progs/cpumask_failure.c tools/testing/selftests/bpf/progs/cpumask_success.c+25 -61 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEmil TsalapatisTejun Heo
SeriesA-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate()

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 [email protected])

* 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

Signature · 1 line
2.34.1