aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-29 13:15:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-29 13:15:24 +0200
commit8ac5efad12d4d96324f6e48ad87441cf300e5bf6 (patch)
tree32379bf00da0b497a887b70cdb090fe3a8f9912a
parent2ec1c8e30df46ee8d50d10780fee932c8eb3b383 (diff)
downloadstable-queue-8ac5efad12d4d96324f6e48ad87441cf300e5bf6.tar.gz
5.15-stable patches
added patches: x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch
-rw-r--r--queue-5.15/series1
-rw-r--r--queue-5.15/x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch42
2 files changed, 43 insertions, 0 deletions
diff --git a/queue-5.15/series b/queue-5.15/series
index 887b936e08..a5925da470 100644
--- a/queue-5.15/series
+++ b/queue-5.15/series
@@ -49,3 +49,4 @@ revert-crypto-api-disallow-identical-driver-names.patch
net-mlx5e-fix-a-race-in-command-alloc-flow.patch
tracing-show-size-of-requested-perf-buffer.patch
tracing-increase-perf_max_trace_size-to-handle-sentinel1-and-docker-together.patch
+x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch
diff --git a/queue-5.15/x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch b/queue-5.15/x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch
new file mode 100644
index 0000000000..0b1727051a
--- /dev/null
+++ b/queue-5.15/x86-cpu-fix-check-for-rdpkru-in-__show_regs.patch
@@ -0,0 +1,42 @@
+From b53c6bd5d271d023857174b8fd3e32f98ae51372 Mon Sep 17 00:00:00 2001
+From: David Kaplan <david.kaplan@amd.com>
+Date: Sun, 21 Apr 2024 21:17:28 +0200
+Subject: x86/cpu: Fix check for RDPKRU in __show_regs()
+
+From: David Kaplan <david.kaplan@amd.com>
+
+commit b53c6bd5d271d023857174b8fd3e32f98ae51372 upstream.
+
+cpu_feature_enabled(X86_FEATURE_OSPKE) does not necessarily reflect
+whether CR4.PKE is set on the CPU. In particular, they may differ on
+non-BSP CPUs before setup_pku() is executed. In this scenario, RDPKRU
+will #UD causing the system to hang.
+
+Fix by checking CR4 for PKE enablement which is always correct for the
+current CPU.
+
+The scenario happens by inserting a WARN* before setup_pku() in
+identiy_cpu() or some other diagnostic which would lead to calling
+__show_regs().
+
+ [ bp: Massage commit message. ]
+
+Signed-off-by: David Kaplan <david.kaplan@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Link: https://lore.kernel.org/r/20240421191728.32239-1-bp@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/process_64.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/process_64.c
++++ b/arch/x86/kernel/process_64.c
+@@ -137,7 +137,7 @@ void __show_regs(struct pt_regs *regs, e
+ log_lvl, d3, d6, d7);
+ }
+
+- if (cpu_feature_enabled(X86_FEATURE_OSPKE))
++ if (cr4 & X86_CR4_PKE)
+ printk("%sPKRU: %08x\n", log_lvl, read_pkru());
+ }
+