Re: [PATCH] sched_ext: reject oversized exit_dump_len

From: Tejun Heo

Date: Tue Nov 24 2026 - 09:06:50 EST


Hello, Sechang.

On Tue, Nov 24, 2026 at 10:05:03AM +0000, Sechang Lim wrote:
> case offsetof(struct sched_ext_ops, exit_dump_len):
> + if (*(u32 *)(udata + moff) > INT_MAX)
> + return -E2BIG;
> ops->exit_dump_len =
> *(u32 *)(udata + moff) ?: SCX_EXIT_DUMP_DFL_LEN;

Maybe read the field once into a local and test that?

case offsetof(struct sched_ext_ops, exit_dump_len): {
u32 dump_len = *(u32 *)(udata + moff);

if (dump_len > INT_MAX)
return -E2BIG;
ops->exit_dump_len = dump_len ?: SCX_EXIT_DUMP_DFL_LEN;
return 1;
}

Thanks.

--
tejun