2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/arch/x86/coco
Ard Biesheuvel 1105ab42a8 x86/sev: Disable jump tables in SEV startup code
When retpolines and IBT are both disabled, the compiler is free to use
jump tables to optimize switch instructions. However, these are emitted
by Clang as absolute references into .rodata:

        jmp    *-0x7dfffe90(,%r9,8)
                        R_X86_64_32S    .rodata+0x170

Given that this code will execute before that address in .rodata has even
been mapped, it is guaranteed to crash a SEV-SNP guest in a way that is
difficult to diagnose.

So disable jump tables when building this code. It would be better if we
could attach this annotation to the __head macro but this appears to be
impossible.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250127114334.1045857-6-ardb+git@google.com
2025-01-28 23:10:29 +01:00
..
sev x86/sev: Disable jump tables in SEV startup code 2025-01-28 23:10:29 +01:00
tdx x86/tdx: Dump attributes and TD_CTLS on boot 2024-12-05 10:27:07 -08:00
core.c x86/sev: Add Secure TSC support for SNP guests 2025-01-07 20:27:23 +01:00
Makefile x86/sev: Move SEV compilation units 2024-07-11 11:55:58 +02:00