From 06bb009320f2091eb1e42d39e62d5c5c24a431e4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 22 Aug 2025 16:25:28 +0200 Subject: [PATCH] 5.15-stable patches added patches: kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch --- ...o-bad-backport-of-fpsimd-sve-sme-fix.patch | 86 +++++++++++++++++++ queue-5.15/series | 1 + 2 files changed, 87 insertions(+) create mode 100644 queue-5.15/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch diff --git a/queue-5.15/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch b/queue-5.15/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch new file mode 100644 index 0000000000..9dbdf75f9f --- /dev/null +++ b/queue-5.15/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch @@ -0,0 +1,86 @@ +From will@kernel.org Fri Aug 22 16:24:21 2025 +From: Will Deacon +Date: Fri, 22 Aug 2025 15:04:02 +0100 +Subject: KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix +To: stable@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Will Deacon , Ard Biesheuvel , Lee Jones , Sasha Levin , Greg Kroah-Hartman , Mark Rutland , Fuad Tabba , Marc Zyngier +Message-ID: <20250822140402.2688-1-will@kernel.org> + +From: Will Deacon + +Upstream commit fbc7e61195e2 ("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 9b19700e623f ("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 9b19700e623f ("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 +Cc: Lee Jones +Cc: Sasha Levin +Cc: Mark Rutland +Cc: Fuad Tabba +Cc: Marc Zyngier +Cc: # 5.15.y, 6.1.y and 6.6.y +Fixes: 806d5c1e1d2e ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 6.6.y +Fixes: 04c50cc23a49 ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 6.1.y +Fixes: 5289ac43b69c ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") # 5.15.y +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kernel/fpsimd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/kernel/fpsimd.c ++++ b/arch/arm64/kernel/fpsimd.c +@@ -1303,10 +1303,10 @@ void fpsimd_save_and_flush_cpu_state(voi + if (!system_supports_fpsimd()) + return; + WARN_ON(preemptible()); +- __get_cpu_fpsimd_context(); ++ get_cpu_fpsimd_context(); + fpsimd_save(); + fpsimd_flush_cpu_state(); +- __put_cpu_fpsimd_context(); ++ put_cpu_fpsimd_context(); + } + + #ifdef CONFIG_KERNEL_MODE_NEON diff --git a/queue-5.15/series b/queue-5.15/series index 9a5c7cb1b2..21e10ec22e 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -560,3 +560,4 @@ mptcp-drop-unused-sk-in-mptcp_push_release.patch mptcp-do-not-queue-data-on-closed-subflows.patch scsi-ufs-ufs-pci-fix-hibernate-state-transition-for-intel-mtl-like-host-controllers.patch scsi-ufs-ufs-pci-fix-default-runtime-and-system-pm-levels.patch +kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch -- 2.47.3