From: Thomas Gleixner <tglx@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Yuanhe Shu <xiangzao@linux.alibaba.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
Boqun Feng <boqun@kernel.org>,
linux-kernel@vger.kernel.org, Michal Hocko <mhocko@suse.com>,
David Rientjes <rientjes@google.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
linux-mm@kvack.org
Subject: Re: [PATCH] rseq: don't promote transient TLS faults to SIGSEGV
Date: Tue, 09 Jun 2026 00:20:33 +0200 [thread overview]
Message-ID: <87cxy04qtq.ffs@fw13> (raw)
In-Reply-To: <22819c09-8d8f-4448-801e-742282e50693@efficios.com>
On Mon, Jun 08 2026 at 08:52, Mathieu Desnoyers wrote:
> On 2026-06-07 22:15, Yuanhe Shu wrote:
>> With oom_score_adj=-1000 the OOM killer finds no killable task, so the
>> rseq SIGSEGV is the sole outcome; otherwise the rseq SIGSEGV can be
>> delivered before the OOM killer queues SIGKILL, and the process exits
>> 139 instead of 137, breaking OOMKilled detection in container
>> runtimes
> As Peter and Thomas said, this is not transient. We simply cannot return
> to userspace with an out-of-date value.
>
> It looks like an issue with the choice of which signal should be
> delivered in priority: rseq force signal enqueues SIGSEGV, and you
> would expect the OOM killer to issue SIGKILL, and somehow it's the
> forced SIGSEGV that wins.
>
> Perhaps look into fixing that instead if you really care about which
> signal is emitted ? (and that's a big _if_)
It's even worse. The proposed patch is actually creating an endless
loop unless there is really a signal pending at some point.
exit_to_user()
rseq_update_usr(); // faults and defers the fault handling to rseq_slowpath_update_usr()
rseq_slowpath_update_usr()
rseq_update_usr(); // Faults again and the fault cannot be resolved
if (!fatal) // Proposed solution....
return;
So if there is no signal queued, then this will end up in exit_to_user()
again, which faults and defers the fault handling to
rseq_slowpath_update_usr() again, which just goes on in circles.
IOW, this would create an unpriviledged DoS attack - not a fatal one,
but at least one which eats up a full time slice in the kernel
forever. Use enough tasks, which register a rseq region and unregister it
after returning to user space ....
So no. And this comment in the patch does not make any sense at all:
> + * rseq_update_usr() sets rseq_event::fatal only on corrupt
> + * user data, which keeps its SIGSEGV. A clear fatal bit is an
> + * unresolved page fault on a still-registered rseq area (e.g.
> + * a CoW that cannot be charged to an OOM-locked memcg): that
> + * is transient, so leave the cached IDs untouched and retry on
> + * a later return to user instead of killing the task.
If the page fault handler fails to wait until the OOM locked memcg
figured out what to do, then that's a clear violation of expectation
vs. resolving a page fault in the context of user/kernel shared memory
with ABI constraints. But definitely not some transient failure which
can be hand waved away.
Not that it matters much whether the task dies from SIGSEGV or SIGKILL,
but that's clearly not a problem which can be papered over in the rseq
code.
Thanks,
tglx
prev parent reply other threads:[~2026-06-08 22:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 2:15 [PATCH] rseq: don't promote transient TLS faults to SIGSEGV Yuanhe Shu
2026-06-08 8:29 ` Peter Zijlstra
2026-06-08 9:15 ` Thomas Gleixner
2026-06-08 12:52 ` Mathieu Desnoyers
2026-06-08 22:20 ` Thomas Gleixner [this message]
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=87cxy04qtq.ffs@fw13 \
--to=tglx@kernel.org \
--cc=boqun@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhocko@suse.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=shakeel.butt@linux.dev \
--cc=xiangzao@linux.alibaba.com \
/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