From: Linus Torvalds <torvalds@linux-foundation.org>
To: Fiona Ebner <f.ebner@proxmox.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Oleg Nesterov <oleg@redhat.com>
Cc: akpm@linux-foundation.org,
Thomas Lamprecht <t.lamprecht@proxmox.com>,
Wolfgang Bumiller <w.bumiller@proxmox.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: segfaults of processes while being killed after commit "mm: make the page fault mmap locking killable"
Date: Tue, 25 Jul 2023 09:38:32 -0700 [thread overview]
Message-ID: <CAHk-=whKBx_UUKagfyF72EJrpqNCupF4yeoPgapjEBe1bynGcw@mail.gmail.com> (raw)
In-Reply-To: <8d063a26-43f5-0bb7-3203-c6a04dc159f8@proxmox.com>
[-- Attachment #1: Type: text/plain, Size: 2069 bytes --]
On Tue, 25 Jul 2023 at 04:16, Fiona Ebner <f.ebner@proxmox.com> wrote:
>
> will end up without a vma and cause/log the segfault. Of course the
> process is already being killed, but I'd argue it is very confusing to
> users when apparent segfaults from such processes are being logged by
> the kernel.
Ahh. Yes, that wasn't the intent. A process that is being killed
should exit with the lethal signal, not SIGSEGV.
This is not new, btw - this situation is exactly the same as if you
use something like NFS where the process is killed and the IO is
interrupted and the page fault faults for that reason.
But I suspect *very* few people actually encounter that NFS situation
(you can get it on local filesystems too, but the IO race window is
then so small as to probably not be triggerable at all).
So the new killable() check is probably much easier to actually
trigger in practice, even though it's not a new situation per se.
What exactly made you notice? Is it just the logging from
'show_unhandled_signals' being set?
Because the actual signal itself, from the
force_sig_fault(SIGSEGV, si_code, (void __user *)address);
in __bad_area_nosemaphore() should be overridden by the fact that a
lethal signal was already pending.
But let's add a couple of signal people rather than the mm people to
the participants. Eric, Oleg - would not an existing fatal signal take
precedence over a new SIGSEGV? I obviously thought it did, but looking
at 'get_signal()' and the signal delivery, I don't actually see any
code to that effect.
Fiona - that patch is easily reverted, and it was done as a separate
patch exactly because I was wondering if there was some subtle reason
we didn't already do that.
But before we revert it, would you mind trying out the attached
trivial patch instead?
I'd also still be interested if the symptoms were anything else than
'show_unhandled_signals' causing the show_signal_msg() dance, and
resulting in a message something like
a.out[1567]: segfault at xyz ip [..] likely on CPU X
in dmesg...
Linus
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 536 bytes --]
arch/x86/mm/fault.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index e8711b2cafaf..b4a0290e963c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -831,6 +831,10 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
*/
local_irq_enable();
+ /* If a fatal signal is pending, don't bother with anything else */
+ if (fatal_signal_pending())
+ return;
+
/*
* Valid to do another page fault here because this one came
* from user space:
next prev parent reply other threads:[~2023-07-25 16:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 11:16 Fiona Ebner
2023-07-25 16:38 ` Linus Torvalds [this message]
2023-07-26 6:51 ` Thomas Lamprecht
2023-07-26 8:19 ` Fiona Ebner
2023-07-26 17:59 ` Linus Torvalds
2023-07-27 7:57 ` Fiona Ebner
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='CAHk-=whKBx_UUKagfyF72EJrpqNCupF4yeoPgapjEBe1bynGcw@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=f.ebner@proxmox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.com \
--cc=t.lamprecht@proxmox.com \
--cc=w.bumiller@proxmox.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