Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Will Deacon" <will@kernel.org>, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, "gus bourg" <gus@bourg.net>
Subject: Re: [PATCH] arm64/efi: Avoid voluntary preemption with efi_mm installed
Date: Tue, 11 Aug 2026 16:19:30 +0200	[thread overview]
Message-ID: <a8d2176a-193f-4ce0-b014-90f3c2ac62c8@app.fastmail.com> (raw)
In-Reply-To: <20260811140430.22832-1-will@kernel.org>



On Tue, 11 Aug 2026, at 16:04, Will Deacon wrote:
> Gus reports a bad kernel memory access when using software PAN
> (CONFIG_ARM64_SW_TTBR0_PAN=y) on a machine with support for EFI runtime
> services:
>
>   Unable to handle kernel access to user memory outside uaccess routines
>     at virtual address 00000000f322ff30
>   Mem abort info:
>     ESR = 0x0000000096000004
>     FSC = 0x04: level 0 translation fault
>   Internal error: Oops: 0000000096000004 [#1]  SMP
>   Workqueue: efi_rts_wq efi_call_rts
>   pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>   pc : efi_call_rts+0xd8/0x288
>   Call trace:
>    efi_call_rts+0xd8/0x288 (P)
>    process_one_work+0x178/0x4f8
>    worker_thread+0x194/0x328
>
> This is because the fpsimd context management code called from
> __efi_fpsimd_begin() can preempt voluntarily, returning later to the EFI
> code with an incorrect value for TTBR0_EL1 thanks to the deferred mm
> switching used by the software PAN implementation.
>
> Since EFI runtime services cannot preempt voluntarily and because the
> fpsimd switching code does not rely on the TTBR0_EL1 mappings, simply
> reorder the fpsimd switch so that it occurs before we change the
> page-table.
>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Reported-by: Gus Bourg <gus@bourg.net>
> Tested-by: Gus Bourg <gus@bourg.net>
> Fixes: a5baf582f4c0 ("arm64/efi: Call EFI runtime services without 
> disabling preemption")
> Link: 
> https://lore.kernel.org/all/20260806000144.3388823-1-gus@bourg.net/
> Signed-off-by: Will Deacon <will@kernel.org>

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>


      reply	other threads:[~2026-08-11 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 14:04 [PATCH] arm64/efi: Avoid voluntary preemption with efi_mm installed Will Deacon
2026-08-11 14:19 ` 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=a8d2176a-193f-4ce0-b014-90f3c2ac62c8@app.fastmail.com \
    --to=ardb@kernel.org \
    --cc=gus@bourg.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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