From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Catalin Marinas" <catalin.marinas@arm.com>
Cc: "Ard Biesheuvel" <ardb+git@google.com>,
linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>
Subject: Re: [PATCH] arm64/mm: Route faults taken by EFI runtime firmware to no_context
Date: Mon, 12 Oct 2026 14:52:59 +0200 [thread overview]
Message-ID: <a6a4a7be-e4f4-4ec8-9974-7c2ffb7245fd@app.fastmail.com> (raw)
In-Reply-To: <aszXyPjGB8zIWKQT@arm.com>
On Mon, 12 Oct 2026, at 14:51, Catalin Marinas wrote:
> On Mon, Oct 12, 2026 at 10:36:41AM +0200, Ard Biesheuvel wrote:
>> > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
>> > index 0b52557652be..db308fe01c4f 100644
>> > --- a/arch/arm64/mm/fault.c
>> > +++ b/arch/arm64/mm/fault.c
>> > @@ -40,6 +40,7 @@
>> > #include <asm/kprobes.h>
>> > #include <asm/mte.h>
>> > #include <asm/processor.h>
>> > +#include <asm/stacktrace.h>
>> > #include <asm/sysreg.h>
>> > #include <asm/system_misc.h>
>> > #include <asm/tlbflush.h>
>> > @@ -621,6 +622,17 @@ static int __kprobes do_page_fault(unsigned long
>> > far, unsigned long esr,
>> > if (faulthandler_disabled() || !mm)
>> > goto no_context;
>> >
>> > + /*
>> > + * Faults taken by EFI runtime services firmware are never resolved by
>> > + * the mm (efi_mm has no VMAs), and must reach __do_kernel_fault() so
>> > + * that efi_runtime_fixup_exception() can recover from them. When EFI
>> > + * runtime services are invoked from a preemptible kthread, neither of
>> > + * the conditions above applies, so check for this explicitly.
>> > + */
>> > + if (IS_ENABLED(CONFIG_EFI) && !user_mode(regs) &&
>> > + is_ttbr0_addr(regs->pc) && current_in_efi())
>> > + goto no_context;
>> > +
>>
>> Looking at this again, I wonder if we should just add a comparison with
>> &efi_mm to the preceding if() condition.
>
> I think mm_is_efi() check in the previous block is simpler. I couldn't
> find any case where this wouldn't cover the more extensive check above
> (or the other way around).
>
Exactly. I'll send a v2.
prev parent reply other threads:[~2026-10-12 12:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 14:34 [PATCH] arm64/mm: Route faults taken by EFI runtime firmware to no_context Ard Biesheuvel
2026-10-12 8:36 ` Ard Biesheuvel
2026-10-12 12:51 ` Catalin Marinas
2026-10-12 12:52 ` Ard Biesheuvel [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=a6a4a7be-e4f4-4ec8-9974-7c2ffb7245fd@app.fastmail.com \
--to=ardb@kernel.org \
--cc=ardb+git@google.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.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