Re: bpf/selftests: test_access_variable_array breaks due to sched_domain::span removal
From: Peter Zijlstra
Date: Wed Apr 08 2026 - 03:56:55 EST
On Wed, Apr 08, 2026 at 10:21:46AM +0530, Saket Kumar Bhaskar wrote:
> We do have cpumask as [] array in sched_group:
>
> struct sched_group {
> struct sched_group *next; /* Must be a circular list */
> atomic_t ref;
>
> unsigned int group_weight;
> unsigned int cores;
> struct sched_group_capacity *sgc;
> int asym_prefer_cpu; /* CPU of highest priority in group */
> int flags;
>
> /*
> * The CPUs this group covers.
> *
> * NOTE: this field is variable length. (Allocated dynamically
> * by attaching extra space to the end of the structure,
> * depending on how many CPUs the kernel has booted up with)
> */
> unsigned long cpumask[];
> };
For now. But given how utterly broken flex arrays are, this thing will
be gone the second we run into that same thing again.
> Wouldn't be good if it is used as:
>
> cpumask0 = sg->cpumask[0];
I'm thinking Alexei's point is that this test should not rely on random
kernel code.