KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
Subsystems (3)
Will Deacon
maintainerPATCH 1/1 KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
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().
--- arch/arm64/kernel/fpsimd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/fpsimd.c +2 -2
@@ -1876,10 +1876,10 @@ void fpsimd_save_and_flush_cpu_state(void)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
Signature · 1 line
2.51.0.rc2.233.g662b1ed5c5-goog
Greg Kroah-Hartman
maintainerQuoted 45 lines · Will Deacon
Upstream commit
fbc7e61195e2("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") relies on interrupts being disabled duringfpsimd_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 infpsimd_save_and_flush_cpu_state()and so the BUG_ON(!may_use_simd()) inkernel_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/0x3cGiven 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 infpsimd_save_and_flush_cpu_state().
Quoted 8 lines
Cc Ard Biesheuvel <[email protected]>Cc Lee Jones <[email protected]>Cc Sasha Levin <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Mark Rutland <[email protected]>Cc Fuad Tabba <[email protected]>Cc Marc Zyngier <[email protected]>Cc <[email protected]> # 5.15.y, 6.1.y and 6.6.y
Now queued up to these trees, thanks!
greg k-h
Patch "KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix" has been added to the 5.15-stable tree
In reply to Will DeaconThis is a note to let you know that I've just added the patch titled
KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
to the 5.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch
and it can be found in the queue-5.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Fri Aug 22 16:24:21 2025
From: Will Deacon <[email protected]>
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: [email protected]
Cc: [email protected], [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Lee Jones <[email protected]>, Sasha Levin <[email protected]>, Greg Kroah-Hartman <[email protected]>, Mark Rutland <[email protected]>, Fuad Tabba <[email protected]>, Marc Zyngier <[email protected]>
Message-ID: <[email protected]>
From: Will Deacon <[email protected]>
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().
--- arch/arm64/kernel/fpsimd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/fpsimd.c +2 -2
@@ -1303,10 +1303,10 @@ void fpsimd_save_and_flush_cpu_state(voiif (!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
Patches currently in stable-queue which might be from [email protected] are
queue-5.15/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch queue-5.15/arm64-mark-kernel-as-tainted-on-sae-and-serror-panic.patch queue-5.15/arm64-entry-mask-daif-in-cpu_switch_to-call_on_irq_stack.patch queue-5.15/mm-ptdump-take-the-memory-hotplug-lock-inside-ptdump_walk_pgd.patch
Patch "KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix" has been added to the 6.1-stable tree
In reply to Will DeaconThis is a note to let you know that I've just added the patch titled
KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Fri Aug 22 16:24:21 2025
From: Will Deacon <[email protected]>
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: [email protected]
Cc: [email protected], [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Lee Jones <[email protected]>, Sasha Levin <[email protected]>, Greg Kroah-Hartman <[email protected]>, Mark Rutland <[email protected]>, Fuad Tabba <[email protected]>, Marc Zyngier <[email protected]>
Message-ID: <[email protected]>
From: Will Deacon <[email protected]>
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().
--- arch/arm64/kernel/fpsimd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/fpsimd.c +2 -2
@@ -1851,10 +1851,10 @@ void fpsimd_save_and_flush_cpu_state(voiif (!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
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/vsock-virtio-resize-receive-buffers-so-that-each-skb.patch queue-6.1/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch queue-6.1/arm64-mark-kernel-as-tainted-on-sae-and-serror-panic.patch queue-6.1/arm64-entry-mask-daif-in-cpu_switch_to-call_on_irq_stack.patch queue-6.1/vsock-virtio-validate-length-in-packet-header-before-skb_put.patch queue-6.1/mm-ptdump-take-the-memory-hotplug-lock-inside-ptdump_walk_pgd.patch queue-6.1/vhost-vsock-avoid-allocating-arbitrarily-sized-skbs.patch
Patch "KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix" has been added to the 6.6-stable tree
In reply to Will DeaconThis is a note to let you know that I've just added the patch titled
KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix
to the 6.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch
and it can be found in the queue-6.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Fri Aug 22 16:24:21 2025
From: Will Deacon <[email protected]>
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: [email protected]
Cc: [email protected], [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Lee Jones <[email protected]>, Sasha Levin <[email protected]>, Greg Kroah-Hartman <[email protected]>, Mark Rutland <[email protected]>, Fuad Tabba <[email protected]>, Marc Zyngier <[email protected]>
Message-ID: <[email protected]>
From: Will Deacon <[email protected]>
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().
--- arch/arm64/kernel/fpsimd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/fpsimd.c +2 -2
@@ -1876,10 +1876,10 @@ void fpsimd_save_and_flush_cpu_state(voiif (!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
Patches currently in stable-queue which might be from [email protected] are
queue-6.6/vsock-virtio-resize-receive-buffers-so-that-each-skb.patch queue-6.6/kvm-arm64-fix-kernel-bug-due-to-bad-backport-of-fpsimd-sve-sme-fix.patch queue-6.6/arm64-mark-kernel-as-tainted-on-sae-and-serror-panic.patch queue-6.6/vsock-virtio-validate-length-in-packet-header-before-skb_put.patch queue-6.6/perf-cxlpmu-remove-unintended-newline-from-irq-name-.patch queue-6.6/iommu-arm-smmu-qcom-add-sm6115-mdss-compatible.patch queue-6.6/arm64-amu-use-capacity_ref_freq-to-set-amu-ratio.patch queue-6.6/mm-ptdump-take-the-memory-hotplug-lock-inside-ptdump_walk_pgd.patch queue-6.6/vhost-vsock-avoid-allocating-arbitrarily-sized-skbs.patch