From: sashiko-bot@kernel.org
To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
tglx@kernel.org, peterz@infradead.org
Cc: 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,
kmehltretter@gmail.com
Subject: Re: [PATCH v2 10/13] selftests/rseq: Test two race windows of the concurrency ID mode switches
Date: Thu, 03 Dec 2026 00:29:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-246859@kernel.org> (raw)
In-Reply-To: <212cdc1e4b36069d1fb0129e8179b5350df329d8.1796169827.git.mathieu.desnoyers@efficios.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/rseq: insecure /tmp file creation in
make_loop_script()
--
commit 96307736da2af3de9716a28136bee61c98351a48
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
selftests/rseq: Test two race windows of the concurrency ID mode switches
This commit adds mm_cid_window_test to exercise two race windows during
mm_cid per-task to per-CPU mode transitions.
> diff --git a/tools/testing/selftests/rseq/mm_cid_window_test.c b/tools/testing/selftests/rseq/mm_cid_window_test.c
> new file mode 100644
> index 0000000000000..32527fd3015f6
> --- /dev/null
> +++ b/tools/testing/selftests/rseq/mm_cid_window_test.c
[ ... ]
> +static int make_loop_script(void)
> +{
> + char *const av[] = { exec_path, NULL };
> + FILE *f;
> +
> + snprintf(exec_path, sizeof(exec_path), "/tmp/mm_cid_window_test.%d", getpid());
> + f = fopen(exec_path, "w");
> + if (!f)
> + return -1;
> + fprintf(f, "#!%s\n", exec_path);
> + if (fclose(f) || chmod(exec_path, 0755))
> + goto unlink;
> + if (execve(exec_path, av, NULL) == -1 && errno == ELOOP)
> + return 0;
> +unlink:
> + remove_file(exec_path);
> + return -1;
> +}
[Severity: Low]
Should make_loop_script() use mkstemp() with fchmod(), and try the test
directory before /tmp as mm_cid_execve_test does?
Opening a predictable PID-based filename in /tmp with fopen(..., "w") and
chmod() is vulnerable to pre-created files or TOCTOU replacement on
multi-user systems before run_child_join() calls execve(exec_path, ...).
Hardcoding /tmp also skips Case 1 when /tmp is mounted noexec.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796169827.git.mathieu.desnoyers@efficios.com?part=10
next prev parent reply other threads:[~2026-12-03 0:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 0:27 [PATCH v2 00/13] sched/mmcid: fixes for execve, mode switches and affinity Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 01/13] sched/mmcid: Move the execve() hooks into exec_mmap() Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 02/13] sched/mmcid: Add the allowed CPUs of each joining task to the mm Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 03/13] sched/mmcid: Serialize joins and exits with affinity changes by pi_lock Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 04/13] sched/mmcid: Give no concurrency ID to user workers Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 05/13] selftests/rseq: Test the concurrency ID after a failed execve Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 06/13] selftests/rseq: Test the concurrency IDs across ownership mode switches Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 07/13] selftests/rseq: Test the upper bound of the concurrency IDs Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 08/13] selftests/rseq: Test an affinity change by another process during execve Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 09/13] selftests/rseq: Test the concurrency IDs after the affinity is widened Mathieu Desnoyers
2026-12-02 0:27 ` [PATCH v2 10/13] selftests/rseq: Test two race windows of the concurrency ID mode switches Mathieu Desnoyers
2026-12-03 0:29 ` sashiko-bot [this message]
2026-12-02 0:27 ` [PATCH v2 11/13] selftests/rseq: Test the last user after an affinity change during execve Mathieu Desnoyers
2026-12-02 0:28 ` [PATCH v2 12/13] selftests/rseq: Test the concurrency IDs with an io_uring SQPOLL thread Mathieu Desnoyers
2026-12-03 0:29 ` sashiko-bot
2026-12-02 0:28 ` [PATCH v2 13/13] selftests/rseq: Test the concurrency IDs after clone3() into a wider cpuset Mathieu Desnoyers
2026-12-02 2:49 ` [PATCH v2 00/13] sched/mmcid: fixes for execve, mode switches and affinity Karl Mehltretter
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=sashiko-outbox-246859@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bestswngs@gmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=jack@suse.cz \
--cc=juri.lelli@redhat.com \
--cc=kees@kernel.org \
--cc=kmehltretter@gmail.com \
--cc=kprateek.nayak@amd.com \
--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=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.