public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-pm@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ayush Jain <Ayush.Jain3@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH 0/3] x86: Don't support kernel-mode FPU with hardirqs disabled
Date: Fri, 16 May 2025 18:30:22 -0700	[thread overview]
Message-ID: <20250517013022.GB1220@sol> (raw)
In-Reply-To: <20250516231858.27899-1-ebiggers@kernel.org>

On Fri, May 16, 2025 at 04:18:55PM -0700, Eric Biggers wrote:
> This series returns to my earlier suggestion to make x86 not support
> kernel-mode FPU when hardirqs are disabled, aligning it with arm64
> (https://lore.kernel.org/r/20250220051325.340691-2-ebiggers@kernel.org).
> To make this possible despite the use of the kernel-mode FPU functions
> by __save_processor_state() (which I mentioned at
> https://lore.kernel.org/r/20250228035924.GC5588@sol.localdomain), I've
> changed __save_processor_state() to use a new function instead of
> (mis)using the kernel-mode FPU functions.
> 
> This slightly reduces the overhead of kernel-mode FPU (since the result
> is fewer checks), and it fixes the issue reported at
> https://lore.kernel.org/r/20250516112217.GBaCcf6Yoc6LkIIryP@fat_crate.local/
> where irq_fpu_usable() incorrectly returned false during CPU
> initialization, causing a crash in the SHA-256 library code.
> 
> Eric Biggers (3):
>   x86/fpu: Add fpu_save_state() for __save_processor_state()
>   x86/pm: Use fpu_save_state() in __save_processor_state()
>   x86/fpu: Don't support kernel-mode FPU when irqs_disabled()
> 
>  arch/x86/include/asm/fpu/api.h |  1 +
>  arch/x86/kernel/fpu/core.c     | 92 ++++++++++++++++++++--------------
>  arch/x86/power/cpu.c           | 18 +++----
>  3 files changed, 62 insertions(+), 49 deletions(-)

I realized I forgot about EFI again.  Ard had mentioned that earlier.

I think we'll need a !irq_disabled()-safe solution for efi_fpu_begin().  It
could be a different function from the regular kernel_fpu_begin(), though.

- Eric

      parent reply	other threads:[~2025-05-17  1:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 23:18 [PATCH 0/3] x86: Don't support kernel-mode FPU with hardirqs disabled Eric Biggers
2025-05-16 23:18 ` [PATCH 1/3] x86/fpu: Add fpu_save_state() for __save_processor_state() Eric Biggers
2025-05-16 23:18 ` [PATCH 2/3] x86/pm: Use fpu_save_state() in __save_processor_state() Eric Biggers
2025-05-16 23:18 ` [PATCH 3/3] x86/fpu: Don't support kernel-mode FPU when irqs_disabled() Eric Biggers
2025-05-17  7:09   ` Ingo Molnar
2025-05-17 18:39     ` Eric Biggers
2025-05-18  6:34       ` Ingo Molnar
2025-05-18 13:18         ` Ard Biesheuvel
2025-05-18 20:01           ` Eric Biggers
2025-05-19  8:05             ` Ingo Molnar
2025-05-19  9:49               ` Ard Biesheuvel
2025-05-19 12:57                 ` Ingo Molnar
2025-05-19 13:50                   ` Ard Biesheuvel
2025-05-20  7:42                     ` Ingo Molnar
2025-05-17  1:30 ` Eric Biggers [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=20250517013022.GB1220@sol \
    --to=ebiggers@kernel.org \
    --cc=Ayush.Jain3@amd.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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