BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] bpf: Clear invalid cpumask bits after population
@ 2026-11-15  6:45 Avi Weiss
  2026-11-15  6:45 ` [PATCH bpf 1/2] bpf: Clear invalid tail bits when populating a cpumask Avi Weiss
  2026-11-15  6:45 ` [PATCH bpf 2/2] selftests/bpf: Check cpumask weight after population Avi Weiss
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Weiss @ 2026-11-15  6:45 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, eddyz87, memxor, shuah, emil, houtao1,
	linux-kselftest, Avi Weiss

bpf_cpumask_populate() copies the final bitmap word without clearing
bits beyond nr_cpu_ids. On configurations where cpumask operations
scan a whole word, those bits can inflate the reported mask weight.

Patch 1 clears the unused tail bits. Patch 2 checks the resulting
weight in the existing populate selftest.

Tested on 97d73c825122 (x86_64, CONFIG_NR_CPUS=64, 4 possible CPUs):
- Unpatched: cpumask/test_populate FAIL (err=5).
- Patched: cpumask/test_populate PASS.
- Patched: cpumask selftests 36/36 subtests PASS.

Not run: allmodconfig, allyesconfig, the full BPF selftest suite,
cross-architecture builds or a dedicated performance benchmark.
The changes have not been rebuilt on top of the target BPF fixes tip.

Avi Weiss (2):
  bpf: Clear invalid tail bits when populating a cpumask
  selftests/bpf: Check cpumask weight after population

 kernel/bpf/cpumask.c                                | 2 +-
 tools/testing/selftests/bpf/progs/cpumask_success.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)


base-commit: 4b4eb7f44ee05754339d07e9df649809f45d14c5
-- 
2.43.0


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

end of thread, other threads:[~2026-11-15  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15  6:45 [PATCH bpf 0/2] bpf: Clear invalid cpumask bits after population Avi Weiss
2026-11-15  6:45 ` [PATCH bpf 1/2] bpf: Clear invalid tail bits when populating a cpumask Avi Weiss
2026-11-15  6:45 ` [PATCH bpf 2/2] selftests/bpf: Check cpumask weight after population Avi Weiss

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