linux/include
Tejun Heo c941d7391f sched_ext: Close root-enable vs sched_ext_dead() race with SCX_TASK_INIT_BEGIN
scx_root_enable_workfn() drops the iter rq lock for ops.init_task() and a
TASK_DEAD @p can fall through sched_ext_dead() in that window. The race hits
when sched_ext_dead() observes SCX_TASK_INIT (the intermediate state before
@p->scx.sched is published) and dereferences NULL via SCX_HAS_OP(NULL,
exit_task), or observes SCX_TASK_NONE during the unlocked init window and
skips cleanup so exit_task() never runs.

Add SCX_TASK_INIT_BEGIN. The enable path writes NONE -> INIT_BEGIN under the
iter rq lock, then takes the rq lock again after init to walk INIT_BEGIN ->
INIT -> READY. sched_ext_dead() that wins the rq-lock race observes
INIT_BEGIN and sets DEAD without calling into ops; the post-init recheck
unwinds via scx_sub_init_cancel_task().

scx_fork() runs single-threaded against sched_ext_dead() (the task is not on
scx_tasks until scx_post_fork() adds it) so its INIT_BEGIN -> INIT walk
needs no rq-lock pairing; it rolls back to NONE on ops.init_task() failure.

The validation matrix grows the INIT_BEGIN row and the INIT_BEGIN -> DEAD
edge; INIT now requires INIT_BEGIN as the predecessor. scx_sub_disable()'s
migration writes INIT_BEGIN as a synthetic predecessor to satisfy the
tightened verification.

The sub-sched paths still race with sched_ext_dead() during the unlocked
init window. This will be fixed by the next patch.

Reported-by: zhidao su <suzhidao@xiaomi.com>
Link: https://lore.kernel.org/all/20260429133155.3825247-1-suzhidao@xiaomi.com/
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
History 2026-05-10 10:08:16 -10:00
..
acpi Power management updates for 7.1-rc1 2026-04-13 19:47:52 -07:00
asm-generic mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
clocksource clocksource/drivers/arm_arch_timer_mmio: Switch over to standalone driver 2025-09-23 12:31:50 +02:00
crypto This update includes the following changes: 2026-04-15 15:22:26 -07:00
cxl ACPI: extlog: Trace CPER CXL Protocol Error Section 2026-01-14 17:09:34 +01:00
drm ttm/pool: port to list_lru. (v2) 2026-04-08 06:52:47 +10:00
dt-bindings pmdomain core: 2026-04-15 14:22:42 -07:00
hyperv mshv: Fix infinite fault loop on permission-denied GPA intercepts 2026-04-04 05:25:53 +00:00
keys keys/trusted_keys: establish PKWM as a trusted source 2026-01-30 09:27:26 +05:30
kunit kunit: irq: Ensure timer doesn't fire too frequently 2026-02-24 14:44:21 -08:00
kvm KVM: arm64: Use standard seq_file iterator for vgic-debug debugfs 2026-02-02 10:59:25 +00:00
linux sched_ext: Close root-enable vs sched_ext_dead() race with SCX_TASK_INIT_BEGIN 2026-05-10 10:08:16 -10:00
math-emu powerpc/math-emu: Remove -w build flag and fix warnings 2022-09-05 17:28:25 +10:00
media media: subdev: Split v4l2_subdev_get_frame_desc_passthrough() into locked and unlocked 2026-03-24 11:58:02 +01:00
memory memory: renesas-rpc-if: Add RZ/G3E xSPI support 2025-05-01 12:22:25 +02:00
misc cxl: Remove driver 2025-03-16 22:04:27 +11:00
net mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
pcmcia pcmcia: remove PCCARD_IODYN 2025-08-16 15:37:47 +02:00
ras PCI/AER: Report CXL or PCIe bus type in AER trace logging 2026-01-22 15:07:04 -07:00
rdma RDMA/core: Check id_priv->restricted_node_type in cma_listen_on_dev() 2026-02-25 07:50:10 -05:00
rv rv: Add support for per-object monitors in DA/HA 2026-03-31 16:47:17 +02:00
scsi SCSI misc on 20260212 2026-02-12 15:43:02 -08:00
soc Reset controller updates for v6.20 2026-01-29 10:24:25 +01:00
sound ASoC: Updates for v7.1 2026-04-13 18:09:48 +02:00
target scsi: target: core: Add emulation for REPORT IDENTIFYING INFORMATION 2025-12-16 21:07:22 -05:00
trace Runtime Verification updates for 7.1: 2026-04-15 17:15:18 -07:00
uapi VFIO updates for v7.1-rc1 2026-04-16 08:01:16 -07:00
ufs scsi: ufs: host: mediatek: Require CONFIG_PM 2026-02-03 22:28:44 -05:00
vdso vdso/datapage: Trim down unnecessary includes 2026-03-11 15:22:39 +01:00
video Merge drm/drm-next into drm-intel-next 2026-02-25 13:23:04 +02:00
xen xen/grant-table: guard gnttab_suspend/resume with CONFIG_HIBERNATE_CALLBACKS 2026-04-10 11:07:21 +02:00
Kbuild drm: ensure drm headers are self-contained and pass kernel-doc 2025-02-12 10:44:43 +02:00