Commit 7cedb020 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86-urgent-2024-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Miscellaneous fixes:

   - Fix kexec() crash if call depth tracking is enabled

   - Fix SMN reads on inaccessible registers on certain AMD systems"

* tag 'x86-urgent-2024-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/amd_nb: Check for invalid SMN reads
  x86/kexec: Fix bug with call depth tracking
parents 7cec2e16 c625dabb
...@@ -215,7 +215,14 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *value, bool write) ...@@ -215,7 +215,14 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *value, bool write)
int amd_smn_read(u16 node, u32 address, u32 *value) int amd_smn_read(u16 node, u32 address, u32 *value)
{ {
return __amd_smn_rw(node, address, value, false); int err = __amd_smn_rw(node, address, value, false);
if (PCI_POSSIBLE_ERROR(*value)) {
err = -ENODEV;
*value = 0;
}
return err;
} }
EXPORT_SYMBOL_GPL(amd_smn_read); EXPORT_SYMBOL_GPL(amd_smn_read);
......
...@@ -295,8 +295,15 @@ void machine_kexec_cleanup(struct kimage *image) ...@@ -295,8 +295,15 @@ void machine_kexec_cleanup(struct kimage *image)
void machine_kexec(struct kimage *image) void machine_kexec(struct kimage *image)
{ {
unsigned long page_list[PAGES_NR]; unsigned long page_list[PAGES_NR];
void *control_page; unsigned int host_mem_enc_active;
int save_ftrace_enabled; int save_ftrace_enabled;
void *control_page;
/*
* This must be done before load_segments() since if call depth tracking
* is used then GS must be valid to make any function calls.
*/
host_mem_enc_active = cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT);
#ifdef CONFIG_KEXEC_JUMP #ifdef CONFIG_KEXEC_JUMP
if (image->preserve_context) if (image->preserve_context)
...@@ -358,7 +365,7 @@ void machine_kexec(struct kimage *image) ...@@ -358,7 +365,7 @@ void machine_kexec(struct kimage *image)
(unsigned long)page_list, (unsigned long)page_list,
image->start, image->start,
image->preserve_context, image->preserve_context,
cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)); host_mem_enc_active);
#ifdef CONFIG_KEXEC_JUMP #ifdef CONFIG_KEXEC_JUMP
if (image->preserve_context) if (image->preserve_context)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment