From: Johannes Berg <johannes@sipsolutions.net>
To: benjamin@sipsolutions.net, linux-um@lists.infradead.org
Cc: Benjamin Berg <benjamin.berg@intel.com>
Subject: Re: [PATCH v3 10/12] um: remove force_flush_all from fork_handler
Date: Wed, 03 Jul 2024 15:00:59 +0200 [thread overview]
Message-ID: <3969a420de91b1f40c37e8b52ebe92605a2fe31a.camel@sipsolutions.net> (raw)
In-Reply-To: <2784bb3e9de2ad88a48d8fa70b01c46e1b2399fc.camel@sipsolutions.net>
On Wed, 2024-07-03 at 11:45 +0200, Johannes Berg wrote:
> On Fri, 2024-05-24 at 23:37 +0200, benjamin@sipsolutions.net wrote:
> > From: Benjamin Berg <benjamin.berg@intel.com>
> >
> > There should be no need for this.
>
> "should" ;-)
>
> This breaks things if glibc enables rseq. That might even be already
> broken in the sense that it might corrupt memory that's put at the same
> place the rseq was installed? But it at least it appears to still work
> without this patch...
Uh, well, it's not quite right what I'm saying ...
Courtesy of Benjamin, currently we have, in userspace memory:
|-- normal address space --|-- empty --|-- stub --|-- empty ...
^ TASK_SIZE
^ STUB_START
now it appears that - at least in 32-bit - the rseq memory is between
TASK_SIZE and STUB_START, so the
> + /* Ensure the new MM is clean and nothing unwanted is mapped */
> + unmap(new_id, 0, STUB_START);
will unmap the memory glibc set up for rseq, and thus immediately lead
to a SIGSEGV when rseq will try to use it, but that happens immediately.
Thus, I see the crash.
If we unmap there only to TASK_SIZE, which is less clean but pretty much
OK since we only use the memory < TASK_SIZE, then this problem goes away
(and Benjamin will resend the patches with that, for now, until it all
goes away with the execve patch.)
If rseq memory was to overlap the "-- stub --" area, then we'd get the
stub corrupted and crash, but I haven't observed that (yet anyway.)
Although perhaps depending on how the corruption works it's not even too
likely.
In any case, it's either not really an issue (rseq memory remains mapped
in the "empty" blocks), or already causing stub corruption, so this
patchset doesn't really (need to) change it, and the later execve()
change will clean it all up properly.
johannes
next prev parent reply other threads:[~2024-07-03 13:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 21:37 [PATCH v3 00/12] Rework stub syscall and page table handling benjamin
2024-05-24 21:37 ` [PATCH v3 01/12] um: Remove stub-data.h include from common-offsets.h benjamin
2024-05-24 21:37 ` [PATCH v3 02/12] um: Create signal stack memory assignment in stub_data benjamin
2024-05-24 21:37 ` [PATCH v3 03/12] um: Add generic stub_syscall6 function benjamin
2024-05-24 21:37 ` [PATCH v3 04/12] um: Rework syscall handling benjamin
2024-05-24 21:37 ` [PATCH v3 05/12] um: compress memory related stub syscalls while adding them benjamin
2024-05-24 21:37 ` [PATCH v3 06/12] um: remove LDT support benjamin
2024-05-24 21:37 ` [PATCH v3 07/12] um: remove copy_context_skas0 benjamin
2024-05-24 21:37 ` [PATCH v3 08/12] um: Delay flushing syscalls until the thread is restarted benjamin
2024-05-24 21:37 ` [PATCH v3 09/12] um: Do not flush MM in flush_thread benjamin
2024-05-24 21:37 ` [PATCH v3 10/12] um: remove force_flush_all from fork_handler benjamin
2024-07-03 9:45 ` Johannes Berg
2024-07-03 10:08 ` Benjamin Berg
2024-07-03 10:10 ` Johannes Berg
2024-07-03 13:00 ` Johannes Berg [this message]
2024-05-24 21:37 ` [PATCH v3 11/12] um: simplify and consolidate TLB updates benjamin
2024-05-24 21:37 ` [PATCH v3 12/12] um: refactor TLB update handling benjamin
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=3969a420de91b1f40c37e8b52ebe92605a2fe31a.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=benjamin.berg@intel.com \
--cc=benjamin@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
/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