* [PATCH] x86/sev: Disable UBSAN on SEV code that may execute very early
@ 2025-01-01 11:51 Ard Biesheuvel
2025-01-01 22:30 ` Nathan Chancellor
2025-01-02 12:01 ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
0 siblings, 2 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2025-01-01 11:51 UTC (permalink / raw)
To: linux-kernel; +Cc: x86, Ard Biesheuvel, Borislav Petkov, Nathan Chancellor
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.
Cc: Borislav Petkov <bp@alien8.de>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/coco/sev/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
index 4e375e7305ac..08de37559307 100644
--- a/arch/x86/coco/sev/Makefile
+++ b/arch/x86/coco/sev/Makefile
@@ -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
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/sev: Disable UBSAN on SEV code that may execute very early
2025-01-01 11:51 [PATCH] x86/sev: Disable UBSAN on SEV code that may execute very early Ard Biesheuvel
@ 2025-01-01 22:30 ` Nathan Chancellor
2025-01-02 12:01 ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-01-01 22:30 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: linux-kernel, x86, Borislav Petkov
On Wed, Jan 01, 2025 at 12:51:20PM +0100, Ard Biesheuvel wrote:
> 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.
>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Seems reasonable to me.
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/x86/coco/sev/Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
> index 4e375e7305ac..08de37559307 100644
> --- a/arch/x86/coco/sev/Makefile
> +++ b/arch/x86/coco/sev/Makefile
> @@ -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
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: x86/boot] x86/sev: Disable UBSAN on SEV code that may execute very early
2025-01-01 11:51 [PATCH] x86/sev: Disable UBSAN on SEV code that may execute very early Ard Biesheuvel
2025-01-01 22:30 ` Nathan Chancellor
@ 2025-01-02 12:01 ` tip-bot2 for Ard Biesheuvel
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Ard Biesheuvel @ 2025-01-02 12:01 UTC (permalink / raw)
To: linux-tip-commits
Cc: Ard Biesheuvel, Borislav Petkov (AMD), Nathan Chancellor, x86,
linux-kernel
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 99b863d2e87210c70354a1c75cc5bcc7a3afdc01
Gitweb: https://git.kernel.org/tip/99b863d2e87210c70354a1c75cc5bcc7a3afdc01
Author: Ard Biesheuvel <ardb@kernel.org>
AuthorDate: Wed, 01 Jan 2025 12:51:20 +01:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 02 Jan 2025 12:13:13 +01:00
x86/sev: Disable UBSAN on SEV code that may execute very early
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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
index 4e375e7..08de375 100644
--- a/arch/x86/coco/sev/Makefile
+++ b/arch/x86/coco/sev/Makefile
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-02 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-01 11:51 [PATCH] x86/sev: Disable UBSAN on SEV code that may execute very early Ard Biesheuvel
2025-01-01 22:30 ` Nathan Chancellor
2025-01-02 12:01 ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox