mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, kprateek.nayak@amd.com, paulmck@kernel.org,
	boqun@kernel.org, shuah@kernel.org, kees@kernel.org,
	viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
	oleg@redhat.com, bestswngs@gmail.com, xmei5@asu.edu,
	xujiakai24@mails.ucas.ac.cn, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Dominik Maier <dmnk@google.com>
Subject: Re: [PATCH 00/17] sched/mmcid: fixes for execve, mode switches and affinity
Date: Sat, 28 Nov 2026 20:22:02 +0100	[thread overview]
Message-ID: <20261128192202.93895-1-kmehltretter@gmail.com> (raw)
In-Reply-To: <87bj79s11m.ffs@fw13>

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

  reply	other threads:[~2026-11-28 19:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 16:17 Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 01/17] sched/mmcid: Give a CID to a task that joins its mm while running Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 02/17] sched/mmcid: Give no concurrency ID to user workers Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 03/17] sched/mmcid: Reset stale state when the first user joins an mm Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 04/17] sched/mmcid: Let a running joiner take its CID after the fixups Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 05/17] sched/mmcid: Take the allowed CPUs of the first user when it joins Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 06/17] sched/mmcid: Synchronize MM teardown with affinity updates Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 07/17] selftests/rseq: Test the concurrency ID after a failed execve Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 08/17] selftests/rseq: Test the concurrency ID after the last user fails execve Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 09/17] selftests/rseq: Test the concurrency IDs across ownership mode switches Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 10/17] selftests/rseq: Test the upper bound of the concurrency IDs Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 11/17] selftests/rseq: Test affinity changes made by another process Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 12/17] selftests/rseq: Test an affinity change by another process during execve Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 13/17] selftests/rseq: Test concurrent thread creation and forced migration Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 14/17] selftests/rseq: Test the concurrency IDs after the affinity is widened Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 15/17] selftests/rseq: Test two race windows of the concurrency ID mode switches Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 16/17] selftests/rseq: Test affinity changes while a task replaces or drops its mm Mathieu Desnoyers
2026-11-17 16:17 ` [PATCH 17/17] selftests/rseq: Test the last user after an affinity change during execve Mathieu Desnoyers
2026-11-28 10:28 ` [PATCH 00/17] sched/mmcid: fixes for execve, mode switches and affinity Thomas Gleixner
2026-11-28 19:22   ` Karl Mehltretter [this message]
2026-11-28 22:40     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128192202.93895-1-kmehltretter@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=bestswngs@gmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dmnk@google.com \
    --cc=jack@suse.cz \
    --cc=juri.lelli@redhat.com \
    --cc=kees@kernel.org \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vschneid@redhat.com \
    --cc=xmei5@asu.edu \
    --cc=xujiakai24@mails.ucas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®