linux-yocto/arch
Will Deacon 23249dade2 KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
Upstream commit fbc7e61195 ("KVM: arm64: Unconditionally save+flush
host FPSIMD/SVE/SME state") relies on interrupts being disabled during
fpsimd_save_and_flush_cpu_state() so that a softirq cannot be taken
while the host floating point context is being saved and potentially try
to use kernel-mode NEON.

Unfortunately, stable kernels without 9b19700e62 ("arm64: fpsimd: Drop
unneeded 'busy' flag") leave interrupts enabled in
fpsimd_save_and_flush_cpu_state() and so the BUG_ON(!may_use_simd()) in
kernel_neon_begin() has been observed to trigger in real-world usage:

 |  kernel BUG at arch/arm64/kernel/fpsimd.c:1904!
 |  Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
 |
 |  Call trace:
 |   kernel_neon_begin+0xdc/0x12c
 |   ...
 |   crypto_aead_decrypt+0x5c/0x6c
 |   seqiv_aead_decrypt+0x88/0x9c
 |   crypto_aead_decrypt+0x5c/0x6c
 |   esp_input+0x280/0x364
 |   xfrm_input+0x6ac/0x16f8
 |   ...
 |   net_rx_action+0x13c/0x31c
 |   handle_softirqs+0x124/0x3d0
 |   __do_softirq+0x14/0x20
 |   ____do_softirq+0x10/0x20
 |   call_on_irq_stack+0x3c/0x74
 |   do_softirq_own_stack+0x1c/0x2c
 |   __irq_exit_rcu+0x54/0xb4
 |   irq_exit_rcu+0x10/0x1c
 |   el1_interrupt+0x38/0x58
 |   el1h_64_irq_handler+0x18/0x24
 |   el1h_64_irq+0x68/0x6c
 |   fpsimd_save+0xe4/0x130
 |   kvm_arch_vcpu_load_fp+0x2c/0x58
 |   kvm_arch_vcpu_load+0x88/0x26c
 |   kvm_sched_in+0x2c/0x3c

Given that 9b19700e62 ("arm64: fpsimd: Drop unneeded 'busy' flag") is
not a fix in its own right, has non-trivial dependencies and is a
reasonably invasive change to the in-kernel use of fpsimd, opt instead
for a simple fix to use the softirq-safe {get,put}_cpu_fpsimd_context()
helpers in fpsimd_save_and_flush_cpu_state().

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Fuad Tabba <tabba@google.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: <stable@vger.kernel.org> # 5.15.y, 6.1.y and 6.6.y
Fixes: 806d5c1e1d ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 6.6.y
Fixes: 04c50cc23a ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 6.1.y
Fixes: 5289ac43b6 ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 5.15.y
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:24:34 +02:00
..
alpha sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
arc sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
arm ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS 2025-08-28 16:24:30 +02:00
arm64 KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix 2025-08-28 16:24:34 +02:00
csky sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
h8300 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
hexagon sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
ia64 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
m68k m68k: Fix lost column on framebuffer debug console 2025-08-28 16:24:27 +02:00
microblaze sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
mips lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap 2025-08-28 16:24:27 +02:00
nds32 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
nios2 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
openrisc sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
parisc parisc: Makefile: fix a typo in palo.conf 2025-08-28 16:24:27 +02:00
powerpc (powerpc/512) Fix possible dma_unmap_single() on uninitialized pointer 2025-08-28 16:24:21 +02:00
riscv sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
s390 mm/ptdump: take the memory hotplug lock inside ptdump_walk_pgd() 2025-08-28 16:24:32 +02:00
sh sh: Do not use hyphen in exported variable name 2025-08-28 16:24:11 +02:00
sparc sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
um um: rtc: Avoid shadowing err in uml_rtc_start() 2025-08-28 16:24:08 +02:00
x86 KVM: VMX: Flush shadow VMCS on emergency reboot 2025-08-28 16:24:32 +02:00
xtensa sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
.gitignore
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:24:48 +02:00