]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/sev: Disable UBSAN on SEV code that may execute very early
authorArd Biesheuvel <ardb@kernel.org>
Wed, 1 Jan 2025 11:51:20 +0000 (12:51 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 2 Jan 2025 11:13:13 +0000 (12:13 +0100)
Clang 14 and older may emit UBSAN instrumentation into code that is
inlined into functions marked with __no_sanitize_undefined¹. This may
result in faults when the code is executed very early, which may be the
case for functions annotated as __head. Now that this requirement is
strictly enforced, the build will fail in this case with the following
message

  Absolute reference to symbol '.data' not permitted in .head.text

Work around this by disabling UBSAN instrumentation on all SEV core
code.

¹ https://lore.kernel.org/r/20250101024348.GA1828419@ax162

  [ bp: Add a footnote with Nathan's detailed explanation and a Fixes
    tag ]

Fixes: 3b6f99a94b04 ("x86/boot: Disable UBSAN in early boot code")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250101115119.114584-2-ardb@kernel.org
arch/x86/coco/sev/Makefile

index 4e375e7305acd9085c859f5e181ae286baf14334..08de375593074611896fbb22f5419dfdfc863c03 100644 (file)
@@ -13,3 +13,6 @@ KCOV_INSTRUMENT_core.o        := n
 # With some compiler versions the generated code results in boot hangs, caused
 # by several compilation units. To be safe, disable all instrumentation.
 KCSAN_SANITIZE         := n
+
+# Clang 14 and older may fail to respect __no_sanitize_undefined when inlining
+UBSAN_SANITIZE         := n