This is a note to let you know that I've just added the patch titled arm64: spectre: Prevent lockdep splat on v4 mitigation enable path to the 5.11-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: arm64-spectre-prevent-lockdep-splat-on-v4-mitigation-enable-path.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a2c42bbabbe260b7626d8459093631a6e16ee0ee Mon Sep 17 00:00:00 2001 From: Will Deacon <will@xxxxxxxxxx> Date: Thu, 18 Feb 2021 14:03:46 +0000 Subject: arm64: spectre: Prevent lockdep splat on v4 mitigation enable path From: Will Deacon <will@xxxxxxxxxx> commit a2c42bbabbe260b7626d8459093631a6e16ee0ee upstream. The Spectre-v4 workaround is re-configured when resuming from suspend, as the firmware may have re-enabled the mitigation despite the user previously asking for it to be disabled. Enabling or disabling the workaround can result in an undefined instruction exception on CPUs which implement PSTATE.SSBS but only allow it to be configured by adjusting the SPSR on exception return. We handle this by installing an 'undef hook' which effectively emulates the access. Installing this hook requires us to take a couple of spinlocks both to avoid corrupting the internal list of hooks but also to ensure that we don't run into an unhandled exception. Unfortunately, when resuming from suspend, we haven't yet called rcu_idle_exit() and so lockdep gets angry about "suspicious RCU usage". In doing so, it tries to print a warning, which leads it to get even more suspicious, this time about itself: | rcu_scheduler_active = 2, debug_locks = 1 | RCU used illegally from extended quiescent state! | 1 lock held by swapper/0: | #0: (logbuf_lock){-.-.}-{2:2}, at: vprintk_emit+0x88/0x198 | | Call trace: | dump_backtrace+0x0/0x1d8 | show_stack+0x18/0x24 | dump_stack+0xe0/0x17c | lockdep_rcu_suspicious+0x11c/0x134 | trace_lock_release+0xa0/0x160 | lock_release+0x3c/0x290 | _raw_spin_unlock+0x44/0x80 | vprintk_emit+0xbc/0x198 | vprintk_default+0x44/0x6c | vprintk_func+0x1f4/0x1fc | printk+0x54/0x7c | lockdep_rcu_suspicious+0x30/0x134 | trace_lock_acquire+0xa0/0x188 | lock_acquire+0x50/0x2fc | _raw_spin_lock+0x68/0x80 | spectre_v4_enable_mitigation+0xa8/0x30c | __cpu_suspend_exit+0xd4/0x1a8 | cpu_suspend+0xa0/0x104 | psci_cpu_suspend_enter+0x3c/0x5c | psci_enter_idle_state+0x44/0x74 | cpuidle_enter_state+0x148/0x2f8 | cpuidle_enter+0x38/0x50 | do_idle+0x1f0/0x2b4 Prevent these splats by running __cpu_suspend_exit() with RCU watching. Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Boqun Feng <boqun.feng@xxxxxxxxx> Cc: Marc Zyngier <maz@xxxxxxxxxx> Cc: Saravana Kannan <saravanak@xxxxxxxxxx> Suggested-by: "Paul E . McKenney" <paulmck@xxxxxxxxxx> Reported-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx> Fixes: c28762070ca6 ("arm64: Rewrite Spectre-v4 mitigation code") Cc: <stable@xxxxxxxxxxxxxxx> Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxx> Acked-by: Marc Zyngier <maz@xxxxxxxxxx> Acked-by: Mark Rutland <mark.rutland@xxxxxxx> Link: https://lore.kernel.org/r/20210218140346.5224-1-will@xxxxxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/arm64/kernel/suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -119,7 +119,7 @@ int cpu_suspend(unsigned long arg, int ( if (!ret) ret = -EOPNOTSUPP; } else { - __cpu_suspend_exit(); + RCU_NONIDLE(__cpu_suspend_exit()); } unpause_graph_tracing(); Patches currently in stable-queue which might be from will@xxxxxxxxxx are queue-5.11/iommu-switch-gather-end-to-the-inclusive-end.patch queue-5.11/arm64-uprobe-return-eopnotsupp-for-aarch32-instruction-probing.patch queue-5.11/arm64-ptrace-fix-seccomp-of-traced-syscall-1-no_syscall.patch queue-5.11/perf-arm-cmn-fix-pmu-instance-naming.patch queue-5.11/arm64-add-missing-isb-after-invalidating-tlb-in-__pr.patch queue-5.11/arm64-spectre-prevent-lockdep-splat-on-v4-mitigation-enable-path.patch queue-5.11/arm64-kexec_file-fix-memory-leakage-in-create_dtb-when-fdt_open_into-fails.patch queue-5.11/perf-vendor-events-arm64-fix-ampere-emag-event-typo.patch queue-5.11/iommu-move-iotlb_sync_map-out-from-__iommu_map.patch queue-5.11/arm64-module-set-plt-section-addresses-to-0x0.patch queue-5.11/perf-arm-cmn-move-irqs-when-migrating-context.patch queue-5.11/iommu-arm-smmu-qcom-fix-mask-extraction-for-bootloader-programmed-smrs.patch queue-5.11/iommu-properly-pass-gfp_t-in-_iommu_map-to-avoid-ato.patch queue-5.11/mm-proc-invalidate-tlb-after-clearing-soft-dirty-pag.patch queue-5.11/arm64-extend-workaround-for-erratum-1024718-to-all-versions-of-cortex-a55.patch