linux/include
Tim Chen b636fef85b sched/cache: Introduce task_struct->sched_cache_grp to fix UAF
Add a sched_cache_grp pointer to task_struct so that scheduler code
can access the cache group directly via the task, without going
through mm->sched_cache_grp.  This decouples the scheduler's hot-path
accesses from the mm_struct.

Each task holds its own refcount on the sched_cache_group, separate
from the reference held by its mm_struct.  The reference is acquired
in copy_mm() (fork) and exec_mmap() (exec), and released in exit_mm().
This fixes the use-after-free when account_mm_sched() reaches the group
through a task whose mm is being switched, as reported by Hyunwoo:

  https://lore.kernel.org/lkml/apPb-Dr4nPYuHQOK@v4bel/

Convert all scheduler code in fair.c and exit.c to use
p->sched_cache_grp instead of p->mm->sched_cache_grp.

Keep the fork/exec/exit reference management out of the generic mm
paths: add sched_cache_fork(), sched_cache_fork_cleanup(),
sched_cache_exec_mmap() and sched_cache_exit_mm() in
kernel/sched/cache_sched.c (with empty stubs for !CONFIG_SCHED_CACHE),
so fs/exec.c, kernel/fork.c and kernel/exit.c each call one helper
instead of open-coding the refcounting under #ifdef.  Also add
sched_cache_group_get() and task_cache_group_get().

Fixes: df0d984759 ("sched/cache: Introduce infrastructure for cache-aware load balancing")
Closes: https://lore.kernel.org/lkml/apPb-Dr4nPYuHQOK@v4bel/
Closes: https://lore.kernel.org/all/343a7e07-7fad-4979-9c9b-82ec038c293c@linux.dev/
Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
Reported-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Co-developed-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: <stable@kernel.org> #7.2.x
Link: https://patch.msgid.link/ae7081dc54736bf115215f9867abb2711a7403fb.1790035273.git.tim.c.chen@linux.intel.com
2026-09-22 10:50:43 +02:00
..
acpi ACPI: bus: Drop two fields from struct acpi_device_pnp 2026-09-01 21:45:50 +02:00
asm-generic kho: make boot time huge page allocation work nicely with KHO 2026-08-23 09:17:38 -07:00
clocksource hyperv-next for v7.3-rc1 2026-08-26 16:47:40 -07:00
crypto This update includes the following changes: 2026-08-19 17:25:42 -07:00
cxl Merge branch 'for-7.3/cxl-port-err-prep' into cxl-for-next 2026-08-05 13:55:07 -07:00
drm Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
dt-bindings sound fixes for 7.3-rc1 2026-08-28 10:01:02 -07:00
hyperv mshv: fix hv_input_get_system_property struct 2026-07-22 21:58:21 +00:00
keys keys: translate request_key_auth pid for the reading procfs instance 2026-09-12 00:43:45 +03:00
kunit gpio updates for v7.3-rc1 2026-08-19 09:10:07 -07:00
kvm KVM/arm64 changes for 7.3 2026-08-24 12:42:07 -04:00
linux sched/cache: Introduce task_struct->sched_cache_grp to fix UAF 2026-09-22 10:50:43 +02:00
math-emu
media media: hevc: add bounded tile-count helpers 2026-09-07 09:01:05 +02:00
memory
misc
net net: psp: avoid conflicts with skb->decrypted and sk_validate_xmit_skb() 2026-09-16 19:18:24 -07:00
pcmcia
ras
rdma RDMA/uverbs: Fix mmap_lock/disassociation_lock circular dependency 2026-09-01 10:03:08 -04:00
rv mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
scsi SCSI updates for 7.3 2026-08-29 11:55:36 -07:00
soc Mostly the usual clk driver updates and new SoC additions plus non-critical 2026-08-26 11:14:30 -07:00
sound ASoC: sdw_utils: cs_amp: Delete bogus and incorrect capture channel fixup 2026-09-14 00:37:41 +01:00
target usb: gadget: f_tcm: keep port count until LUN teardown completes 2026-08-14 10:49:21 +09:00
trace dma-mapping fixes for Linux 7.3 2026-09-17 08:03:37 -07:00
uapi Input updates for v7.3-rc3 2026-09-20 07:02:34 -07:00
ufs Merge patch series "scsi: ufs: Add support for the aggregated read query opcode" 2026-08-07 11:34:35 -04:00
vdso vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY 2026-08-10 16:25:21 +02:00
video fbdev: maxine: fix 64-bit build error 2026-08-20 23:45:07 +02:00
xen xen: Drop CONFIG_XEN_AUTO_XLATE 2026-08-06 13:18:32 +02:00
Kbuild