]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/boot: Disable UBSAN in early boot code
authorArd Biesheuvel <ardb@kernel.org>
Thu, 5 Dec 2024 11:28:09 +0000 (12:28 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Dec 2024 12:18:54 +0000 (13:18 +0100)
commit3b6f99a94b04b389292590840d96342b7dd08941
tree31e17a3ffa6f2f3a1fa3acee44a16ed15de94b87
parent0d9b9a328cb605419ed046d341dc2a3d66ee0256
x86/boot: Disable UBSAN in early boot code

The early boot code runs from a 1:1 mapping of memory, and may execute
before the kernel virtual mapping is even up. This means absolute symbol
references cannot be permitted in this code.

UBSAN injects references to global data structures into the code, and
without -fPIC, those references are emitted as absolute references to
kernel virtual addresses. Accessing those will fault before the kernel
virtual mapping is up, so UBSAN needs to be disabled in early boot code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20241205112804.3416920-13-ardb+git@google.com
arch/x86/coco/sev/shared.c
arch/x86/include/asm/init.h