diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index f86ee15be7cb..b685f45b4fd0 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -10380,11 +10380,9 @@ static int __init scx_init(void) /* * cid-form must end exactly at @priv - validate_ops() skips * cpu_acquire/cpu_release for cid-form because reading those fields - * past the BPF allocation would be UB. offsetofend() on both sides - * instead of sizeof() on sched_ext_ops_cid to sidestep trailing - * struct padding (e.g. 32-bit PPC tail-pads ops_cid past @priv). + * past the BPF allocation would be UB. */ - BUILD_BUG_ON(offsetofend(struct sched_ext_ops_cid, priv) != + BUILD_BUG_ON(offsetof(struct sched_ext_ops_cid, __end) != offsetofend(struct sched_ext_ops, priv)); #undef CID_OFFSET_MATCH diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h index 0ed79bd891c7..cd33984cffcf 100644 --- a/kernel/sched/ext_internal.h +++ b/kernel/sched/ext_internal.h @@ -938,6 +938,9 @@ struct sched_ext_ops_cid { /* internal use only, must be NULL */ void __rcu *priv; + + /* layout end anchor for the BUILD_BUG_ON in scx_init(); keep last */ + char __end[0]; }; enum scx_opi {