diff options
| author | Tejun Heo <tj@kernel.org> | 2026-05-08 05:50:08 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-05-08 06:08:01 -1000 |
| commit | ca1d48a86fab82da94cf0ddf586b484dcd04df6e (patch) | |
| tree | cf54d83a176f74a6778ccd382e6565398f0a2e10 | |
| parent | e18002d2c791456546505d64f308981f38316ca9 (diff) | |
sched_ext: Use offsetofend on both sides of the ops_cid layout assert
sizeof() includes trailing struct pad, offsetofend() doesn't. On
32-bit PPC, sched_ext_ops_cid tail-pads 4 bytes past @priv and the
assert trips. Use offsetofend() on both sides.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605081637.DbH4SZ1E-lkp@intel.com/
Fixes: 7e655ed7b953 ("sched_ext: Add bpf_sched_ext_ops_cid struct_ops type")
Signed-off-by: Tejun Heo <tj@kernel.org>
| -rw-r--r-- | kernel/sched/ext.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 7ac7d10a41be..f86ee15be7cb 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -10380,9 +10380,11 @@ 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. + * 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). */ - BUILD_BUG_ON(sizeof(struct sched_ext_ops_cid) != + BUILD_BUG_ON(offsetofend(struct sched_ext_ops_cid, priv) != offsetofend(struct sched_ext_ops, priv)); #undef CID_OFFSET_MATCH |
