Re: bpf/selftests: test_access_variable_array breaks due to sched_domain::span removal

From: Alan Maguire

Date: Wed Apr 08 2026 - 04:37:28 EST


On 08/04/2026 08:56, Peter Zijlstra wrote:
> 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.
>

looks like we already have

struct bpf_testmod_struct_arg_3 {
int a;
int b[];
};

and function

int bpf_testmod_test_struct_arg_3(int a, int b, struct bpf_testmod_struct_arg_2 c);

...in selftests/bpf/test_kmods/bpf_testmod.c so we could potentially use that instead.

Alan