x86/sev: Disable KMSAN for memory encryption TUs
authorChangbin Du <changbin.du@huawei.com>
Fri, 8 Mar 2024 04:44:01 +0000 (12:44 +0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 8 Mar 2024 07:59:22 +0000 (08:59 +0100)
Instrumenting sev.c and mem_encrypt_identity.c with KMSAN will result in
a triple-faulting kernel. Some of the code is invoked too early during
boot, before KMSAN is ready.

Disable KMSAN instrumentation for the two translation units.

  [ bp: Massage commit message. ]

Signed-off-by: Changbin Du <changbin.du@huawei.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240308044401.1120395-1-changbin.du@huawei.com
arch/x86/kernel/Makefile
arch/x86/mm/Makefile

index 0000325ab98f4dc7408d0f338aab42bf6850c367..04591d0145e0d25f14bc63862d59d7b1feb0e26c 100644 (file)
@@ -33,6 +33,7 @@ KASAN_SANITIZE_sev.o                                  := n
 KCSAN_SANITIZE := n
 KMSAN_SANITIZE_head$(BITS).o                           := n
 KMSAN_SANITIZE_nmi.o                                   := n
+KMSAN_SANITIZE_sev.o                                   := n
 
 # If instrumentation of the following files is enabled, boot hangs during
 # first second.
index c80febc44cd2feed47bf3c419accb98b12c1e38b..6ec103bedcf1def85b90c56b9c0acd4b724d4c18 100644 (file)
@@ -16,6 +16,7 @@ KASAN_SANITIZE_pgprot.o               := n
 KCSAN_SANITIZE := n
 # Avoid recursion by not calling KMSAN hooks for CEA code.
 KMSAN_SANITIZE_cpu_entry_area.o := n
+KMSAN_SANITIZE_mem_encrypt_identity.o := n
 
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_mem_encrypt.o            = -pg