Skip to contentSkip to conversation

x86/hvm: Configuration for Linear Address Space Separation

PATCH In review Andrew Cooper 2 participants 3 messages Mar 26 – Mar 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Configuration for Linear Address Space Separation

LASS is a feature designed in the aftermath of Meltdown, which codifies the user/kernel split in address space in order to block entire classes of sidechanels. Specifically, it allows the CPU to terminate any memory access into the wrong half of the address space based on linear address alone and without needing a pagewalk.

It is available in CPUs starting with Intel Sapphire Rapids (2023).

For now, allow LASS to be opted in to, but leave it off by default. Some work in the emulator is going to be needed to enable it by default.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

This needs rebasing around my correction to the FRED comment.

Abdel is going to look into the emulator side of things, which is going to be easier with this patch already in place. I intend to get it fully supported for 4.22.

---
 xen/arch/x86/hvm/hvm.c                      | 1 +
 xen/arch/x86/include/asm/x86-defns.h        | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +1 -0
index 4d37a93c57a5..b62b058861c3 100644
@@ -1019,6 +1019,7 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->feat.pku      ? X86_CR4_PKE               : 0) |
             (cet              ? X86_CR4_CET               : 0) |
             (p->feat.pks      ? X86_CR4_PKS               : 0) |
+            (p->feat.lass     ? X86_CR4_LASS              : 0) |
             0);
 }
 
xen/arch/x86/include/asm/x86-defns.h +1 -0
index edeb0b4ff95a..51b603bb1a14 100644
@@ -82,6 +82,7 @@
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
+#define X86_CR4_LASS       (_AC(1, ULL) << 27) /* Linear Address Space Separation */
 #define X86_CR4_FRED       (_AC(1, ULL) << 32) /* Fast Return and Event Delivery */
 
 #define X86_CR8_VALID_MASK 0xf
xen/include/public/arch-x86/cpufeatureset.h +1 -1
index 9cd778586f10..c0b52e4c9ef9 100644
@@ -304,7 +304,7 @@ XEN_CPUFEATURE(SM3,          10*32+ 1) /*A  SM3 Instructions */
 XEN_CPUFEATURE(SM4,          10*32+ 2) /*A  SM4 Instructions */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
-XEN_CPUFEATURE(LASS,         10*32+ 6) /*   Linear Address Space Separation */
+XEN_CPUFEATURE(LASS,         10*32+ 6) /*s  Linear Address Space Separation */
 XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(ARCH_PERF_MON, 10*32+8) /*   Architectural Perfmon */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Andrew Cooper

LASS is a feature designed in the aftermath of Meltdown, which codifies the user/kernel split in address space in order to block entire classes of sidechanels. Specifically, it allows the CPU to terminate any memory access into the wrong half of the address space based on linear address alone and without needing a pagewalk.

Quoted 6 lines

It is available in CPUs starting with Intel Sapphire Rapids (2023).

For now, allow LASS to be opted in to, but leave it off by default. Some work in the emulator is going to be needed to enable it by default.

Quoted 3 lines

Abdel is going to look into the emulator side of things, which is going to be easier with this patch already in place. I intend to get it fully supported for 4.22.

It indeed as "as simple as this" if you leave out the emulator part.

Jan

#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper

LASS is a feature designed in the aftermath of Meltdown, which codifies the user/kernel split in address space in order to block entire classes of sidechanels. Specifically, it allows the CPU to terminate any memory access into the wrong half of the address space based on linear address alone and without needing a pagewalk.

Quoted 7 lines
Quoted 6 lines

It is available in CPUs starting with Intel Sapphire Rapids (2023).

For now, allow LASS to be opted in to, but leave it off by default. Some work in the emulator is going to be needed to enable it by default.

Thanks, although SPR should have been SRF.  I'll fix up on commit.

Quoted 5 lines
Quoted 4 lines

Abdel is going to look into the emulator side of things, which is going to be easier with this patch already in place. I intend to get it fully supported for 4.22.

It indeed as "as simple as this" if you leave out the emulator part.

Yeah, quite possibly the easiest feature I've encountered.  It's a shame we need so much plumbing change in the emulator to complete it.

~Andrew