9dd7462461
by cherry-picking the relevant commits from launchpad/lunar [0]. (relevant commits are based on k.o/stable commits for this) minimally tested by booting my (ryzen) machine with this kernel and skimming through dmesg after boot. [0] git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/lunar Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
70 lines
2.6 KiB
Diff
70 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Fri, 16 Jun 2023 22:15:31 +0200
|
|
Subject: [PATCH] x86/mem_encrypt: Unbreak the AMD_MEM_ENCRYPT=n build
|
|
|
|
Moving mem_encrypt_init() broke the AMD_MEM_ENCRYPT=n because the
|
|
declaration of that function was under #ifdef CONFIG_AMD_MEM_ENCRYPT and
|
|
the obvious placement for the inline stub was the #else path.
|
|
|
|
This is a leftover of commit 20f07a044a76 ("x86/sev: Move common memory
|
|
encryption code to mem_encrypt.c") which made mem_encrypt_init() depend on
|
|
X86_MEM_ENCRYPT without moving the prototype. That did not fail back then
|
|
because there was no stub inline as the core init code had a weak function.
|
|
|
|
Move both the declaration and the stub out of the CONFIG_AMD_MEM_ENCRYPT
|
|
section and guard it with CONFIG_X86_MEM_ENCRYPT.
|
|
|
|
Fixes: 439e17576eb4 ("init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()")
|
|
Reported-by: kernel test robot <lkp@intel.com>
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
Closes: https://lore.kernel.org/oe-kbuild-all/202306170247.eQtCJPE8-lkp@intel.com/
|
|
|
|
(cherry picked from commit 0a9567ac5e6a40cdd9c8cd15b19a62a15250f450)
|
|
CVE-2022-40982
|
|
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
|
|
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
|
|
Acked-by: Stefan Bader <stefan.bader@canonical.com>
|
|
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
|
|
(cherry picked from commit 305ba9053fdf1503a6717e3a96a7d9e0cd48ef15)
|
|
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
|
---
|
|
arch/x86/include/asm/mem_encrypt.h | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h
|
|
index a95914f479b8..8f513372cd8d 100644
|
|
--- a/arch/x86/include/asm/mem_encrypt.h
|
|
+++ b/arch/x86/include/asm/mem_encrypt.h
|
|
@@ -17,6 +17,12 @@
|
|
|
|
#include <asm/bootparam.h>
|
|
|
|
+#ifdef CONFIG_X86_MEM_ENCRYPT
|
|
+void __init mem_encrypt_init(void);
|
|
+#else
|
|
+static inline void mem_encrypt_init(void) { }
|
|
+#endif
|
|
+
|
|
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
|
|
|
extern u64 sme_me_mask;
|
|
@@ -51,8 +57,6 @@ void __init mem_encrypt_free_decrypted_mem(void);
|
|
|
|
void __init sev_es_init_vc_handling(void);
|
|
|
|
-void __init mem_encrypt_init(void);
|
|
-
|
|
#define __bss_decrypted __section(".bss..decrypted")
|
|
|
|
#else /* !CONFIG_AMD_MEM_ENCRYPT */
|
|
@@ -84,8 +88,6 @@ early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, bool enc) {}
|
|
|
|
static inline void mem_encrypt_free_decrypted_mem(void) { }
|
|
|
|
-static inline void mem_encrypt_init(void) { }
|
|
-
|
|
#define __bss_decrypted
|
|
|
|
#endif /* CONFIG_AMD_MEM_ENCRYPT */
|