David Kaplan 3b1ce482e2 x86/cpu: Fix check for RDPKRU in __show_regs()
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>
2024-05-02 16:32:42 +02:00
..
2023-08-17 17:07:09 +02:00
2022-09-26 10:13:16 -07:00
2023-09-07 13:52:20 -07:00
2023-08-09 11:58:34 -07:00
2023-06-19 16:19:10 -07:00
2023-08-31 12:20:12 -07:00
2023-09-19 07:04:49 +02:00
2022-12-10 10:33:11 -06:00
2023-07-11 14:12:19 -07:00
2022-09-26 19:46:16 -07:00
2023-08-31 12:20:12 -07:00
2023-06-27 15:05:41 -07:00