Miscellaneous fixes:

- Fix kexec() crash if call depth tracking is enabled
 
  - Fix SMN reads on inaccessible registers on certain AMD systems
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmZkC+0RHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1iPHA/+P+lT60i13QPX9HICpAKLC0ZPpBj+OXco
 jo/2MJddO04EVvYkojjzvvKVHEz4Q8O15IUprqeXbhp49xSdhX5Yn8o46xPrXoYz
 WkHphX6qiMKBeNE+i6hYzUKl+vfpyVQwUazUlfS/xk7H5CaolHdhOd5riIx6D9M1
 XYx9CT+8bWLppxL5LGTS1G1g03S+WnWDK0yr7FIY7i1SCzPqu0v2IUGFrvNhTrhu
 Ejj3YyVHDwBokkhDbzdV2rAUHzC7JkufipOM6I7TgFVRO783wP/o23b8syc+OtQD
 aNZUAyH7pNWiPUlUz4r3FjRUzqGIcQTKNZdHqGTDaHqH7dT/e09CYJ9LTiUEL0z4
 mx68gHemn8NKG+QuOixd78HiPTV27qhdivpwgVzFZyXZYILI38UTqqK55eKdsgba
 c0jtID74FGWTNpR06Ahs6G3uldQEqkZ5po08S7YTstw75vTb+c5iQznJffVwDKnb
 +fpBVfJBYIoVMZ7oWonEV3zPa3fMCkfnAByTcKqBNnAIkr7xgAuQuCOqgv+4b/7Y
 yDXbGlrdLCjoOdDVXVrpVPNXONd93M2wR8dXBeNJ+lp05ElfzNRyWriFBGA3kSOb
 H3T8XVN3O4nHWHNQfSwSrAqmChpV+W3TuBUjKtEHVAeQ3Ub31ja2us+RpbhQc1Jm
 iXMw3zNITeQ=
 =Gvh6
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-06-08 09:36:08 -07:00
commit 7cedb020d5
2 changed files with 17 additions and 3 deletions

View File

@ -215,7 +215,14 @@ out:
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);

View File

@ -295,8 +295,15 @@ void machine_kexec_cleanup(struct kimage *image)
void machine_kexec(struct kimage *image)
{
unsigned long page_list[PAGES_NR];
void *control_page;
unsigned int host_mem_enc_active;
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
if (image->preserve_context)
@ -358,7 +365,7 @@ void machine_kexec(struct kimage *image)
(unsigned long)page_list,
image->start,
image->preserve_context,
cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT));
host_mem_enc_active);
#ifdef CONFIG_KEXEC_JUMP
if (image->preserve_context)