Re: [PATCH 00/17] sched/mmcid: fixes for execve, mode switches and affinity
From: Karl Mehltretter
Date: Sat Nov 28 2026 - 14:22:22 EST
On Sat, 28 Nov 2026 11:28:05 +0100, Thomas Gleixner wrote:
> + /*
> + * Reactivating MM CID is only required for the success case. The
> + * exec()'ing task deactivates MM CID after bprm->point_of_no_return has
> + * been set true, so any failure after that point will prevent the task
> + * from going back to user space.
> + */
> sched_mm_cid_after_execve(current);
That doesn't hold under ptrace.
bprm_execve() uses force_fatal_sig(SIGSEGV), so a tracer can suppress the
SIGSEGV with PTRACE_CONT(pid, 0) and let the task return to user space with
mm_cid.active == 0 and mm_cid == MM_CID_UNSET.
I reproduced this on tip/sched/core (arm64 KVM, RT and !RT). A traced
child unregisters its rseq area and calls execve() on a static ELF with
an invalid e_entry, which fails in load_elf_binary() after
begin_new_exec() has already run.
The tracer catches SIGSEGV, sets PC to the mapped _start, and continues with
signal 0. The child then registers a new rseq area and reads mm_cid:
baseline (RT and !RT): rseq_rc=0, mm_cid=0x00000000
your patch (RT and !RT): rseq_rc=0, mm_cid=0x80000000
I also ran Mathieu's tests on the same kernels (2 and 4 vCPUs, RT and !RT,
PROVE_LOCKING=y):
- execve_test case 1 (07/17): fails on baseline (0x80000000), passes on
all four configs with your patch.
- execve_test case 2 (08/17): fails on 2 vCPUs (mm_cid 1 on CPU 1).
- execve_test case 3 (17/17): fails on !RT baseline, skips on all four
configs with your patch.
- exec_affinity_test case 2 (12/17): still fails on 4 vCPUs.
Thanks,
Karl