target/i386: Add support for LASS
cover target/i386: Add support for LASS
This series adds QEMU support for Linear Address Space Separation (LASS) [1], an Intel security feature that prevents a class of side-channel attacks relying on speculative accesses across the user/kernel boundary. Paging, along with SMEP and SMAP, already provides mode-based access protection, but enforcing it requires a page walk whose timing can leak the layout of kernel memory. LASS applies the equivalent protections during linear-address pre-processing: given the usual partitioning of the linear address space into a user half (bit 63 clear) and a supervisor half (bit 63 set), an access targeting the opposite half is rejected on the basis of bit 63 alone, before any page walk.
This series enumerates the LASS CPUID bit, recognizes CR4.LASS, and exposes LASS on the relevant Intel CPU models via new versioned models. LASS is not emulated by TCG.
Exposing LASS to a guest also requires KVM support: KVM must validate the CPUID bit and CR4.LASS, and enforce LASS violations in its instruction emulator. That enabling is currently under review [2].
Tested with a Linux guest on LASS-capable hardware: LASS is enumerated and CR4.LASS is set under KVM, and not enumerated under TCG.
[1] Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, Section 4.3, "Linear-Address-Space Separation (LASS)".
[2] https://lore.kernel.org/kvm/[email protected]/
Isaku Yamahata (2):
target/i386: Add support for LASS in CPUID enumeration target/i386: Add LASS support in CR4
Kishen Maloor (3):
target/i386: Introduce DiamondRapids-v3 to enable LASS target/i386: Introduce SierraForest-v7 to enable LASS target/i386: Introduce ClearwaterForest-v5 to enable LASS
target/i386/cpu.c | 26 +++++++++++++++++++++++++- target/i386/cpu.h | 7 ++++++- target/i386/helper.c | 4 ++++ 3 files changed, 35 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.1
PATCH 1/5 target/i386: Add support for LASS in CPUID enumeration
From: Isaku Yamahata <[email protected]>
Linear Address Space Separation (LASS) is a security feature that prevents a class of side-channel attacks relying on speculative accesses across the user/kernel boundary. Paging, along with SMEP and SMAP, already provides mode-based access protection, but enforcing it requires a page walk whose timing can leak the layout of kernel memory.
LASS applies the equivalent protections during linear-address pre-processing, before any page walk. Given the usual partitioning of the linear address space into a user half (bit 63 clear) and a supervisor half (bit 63 set), an access targeting the opposite half is rejected on the basis of bit 63 alone, raising a #GP. LASS is enabled via CR4.LASS[bit 27] and applies only in IA-32e mode.
Feature bit:
CPUID.(EAX=7,ECX=1):EAX[6]
A CPUID_7_1_EAX_LASS macro was previously added in commit 31df29c532a9 ("i386/tdx: Add supported CPUID bits related to TD Attributes"), but the bit was left unnamed in feature_word_info[FEAT_7_1_EAX]. Add the "lass" feature name to expose it via -cpu host, -cpu max, or an explicit +lass.
Exposing LASS to a guest also requires KVM support: KVM must validate the CPUID bit and CR4.LASS, and enforce LASS violations in its instruction emulator.
LASS is not implemented in TCG, so the bit is not added to TCG_7_1_EAX_FEATURES.
More details can be found in the Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, Section 4.3, "Linear-Address-Space Separation (LASS)".
---
KVM support for LASS is currently under review:
https://lore.kernel.org/kvm/[email protected]/
target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -1243,7 +1243,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .type = CPUID_FEATURE_WORD, .feat_names = {"sha512" ,"sm3" ,"sm4" ,NULL , -"avx-vnni" ,"avx512-bf16" ,NULL ,"cmpccxadd" , +"avx-vnni" ,"avx512-bf16" ,"lass" ,"cmpccxadd" ,NULL ,NULL ,"fzrm" ,"fsrs" ,"fsrc" ,NULL ,NULL ,NULL , NULL, "fred", "lkgs", "wrmsrns",
Signature · 1 line
2.47.1
Re: [PATCH 1/5] target/i386: Add support for LASS in CPUID enumeration
Quoted 43 lines · Kishen Maloor
Date: Tue, 25 Aug 2026 20:57:30 -0700
From: Kishen Maloor <[email protected]>
Subject: [PATCH 1/5] target/i386: Add support for LASS in CPUID enumeration
X-Mailer: git-send-email 2.47.1From: Isaku Yamahata <[email protected]>
Linear Address Space Separation (LASS) is a security feature that prevents a class of side-channel attacks relying on speculative accesses across the user/kernel boundary. Paging, along with SMEP and SMAP, already provides mode-based access protection, but enforcing it requires a page walk whose timing can leak the layout of kernel memory.
LASS applies the equivalent protections during linear-address pre-processing, before any page walk. Given the usual partitioning of the linear address space into a user half (bit 63 clear) and a supervisor half (bit 63 set), an access targeting the opposite half is rejected on the basis of bit 63 alone, raising a #GP. LASS is enabled via CR4.LASS[bit 27] and applies only in IA-32e mode.
Feature bit:
CPUID.(EAX=7,ECX=1):EAX[6]A
CPUID_7_1_EAX_LASSmacro was previously added in commit31df29c532a9("i386/tdx: Add supported CPUID bits related to TD Attributes"), but the bit was left unnamed in feature_word_info[FEAT_7_1_EAX]. Add the "lass" feature name to expose it via -cpu host, -cpu max, or an explicit +lass.Exposing LASS to a guest also requires KVM support: KVM must validate the CPUID bit and CR4.LASS, and enforce LASS violations in its instruction emulator.
LASS is not implemented in TCG, so the bit is not added to
TCG_7_1_EAX_FEATURES.More details can be found in the Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, Section 4.3, "Linear-Address-Space Separation (LASS)".
Signed-off-by Isaku Yamahata <[email protected]>[kishen: rewrote commit message, rebased]Signed-off-by Kishen Maloor <[email protected]>
Quoted 6 lines
---
KVM support for LASS is currently under review:
https://lore.kernel.org/kvm/[email protected]/target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 2/5 target/i386: Add LASS support in CR4
In reply to Kishen MaloorFrom: Isaku Yamahata <[email protected]>
CR4.LASS[bit 27] enables Linear Address Space Separation, and may be set only when CPUID.(EAX=7,ECX=1):EAX[6] enumerates LASS.
Recognize CR4.LASS as a valid bit by adding CR4_LASS_MASK to the known bits, i.e. clearing it from CR4_RESERVED_MASK. Mark it reserved in cr4_reserved_bits() and clear it in cpu_x86_update_cr4() when the guest CPUID does not enumerate LASS. This keeps CR4 handling consistent on paths that reach cpu_x86_update_cr4(), such as gdbstub register writes.
LASS is not emulated by TCG, so it is not added to TCG_7_1_EAX_FEATURES and cannot be set under TCG (helper_write_crN() and helper_vmrun() both reject reserved bits via cr4_reserved_bits()).
--- target/i386/cpu.h | 7 ++++++- target/i386/helper.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-)
target/i386/cpu.h +6 -1
@@ -277,6 +277,7 @@ typedef enum X86Seg {#define CR4_PKE_MASK (1U << 22)#define CR4_CET_MASK (1U << 23)#define CR4_PKS_MASK (1U << 24) +#define CR4_LASS_MASK (1U << 27)#define CR4_LAM_SUP_MASK (1U << 28)#ifdef TARGET_X86_64
@@ -293,7 +294,8 @@ typedef enum X86Seg { | CR4_LA57_MASK \ | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \ | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_CET_MASK \ - | CR4_PKS_MASK | CR4_LAM_SUP_MASK | CR4_FRED_MASK)) + | CR4_PKS_MASK | CR4_LASS_MASK | CR4_LAM_SUP_MASK \ + | CR4_FRED_MASK))#define DR6_BD (1 << 13)#define DR6_BS (1 << 14)
@@ -3064,6 +3066,9 @@ static inline uint64_t cr4_reserved_bits(CPUX86State *env)if (!(env->features[FEAT_7_0_ECX ] &CPUID_7_0_ECX_PKS )) { reserved_bits |=CR4_PKS_MASK ; } +if (!(env->features[FEAT_7_1_EAX ] &CPUID_7_1_EAX_LASS )) { + reserved_bits |=CR4_LASS_MASK ; + }if (!(env->features[FEAT_7_1_EAX ] &CPUID_7_1_EAX_LAM )) { reserved_bits |=CR4_LAM_SUP_MASK ; }
target/i386/helper.c +4 -0
@@ -229,6 +229,10 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4) new_cr4 &= ~CR4_PKS_MASK ; } +if (!(env->features[FEAT_7_1_EAX ] &CPUID_7_1_EAX_LASS )) { + new_cr4 &= ~CR4_LASS_MASK ; + } +if (!(env->features[FEAT_7_1_EAX ] &CPUID_7_1_EAX_LAM )) { new_cr4 &= ~CR4_LAM_SUP_MASK ; }
Signature · 1 line
2.47.1
Re: [PATCH 2/5] target/i386: Add LASS support in CR4
Quoted 20 lines · Kishen Maloor
Date: Tue, 25 Aug 2026 20:57:31 -0700
From: Kishen Maloor <[email protected]>
Subject: [PATCH 2/5] target/i386: Add LASS support in CR4
X-Mailer: git-send-email 2.47.1From: Isaku Yamahata <[email protected]>
CR4.LASS[bit 27] enables Linear Address Space Separation, and may be set only when CPUID.(EAX=7,ECX=1):EAX[6] enumerates LASS.
Recognize CR4.LASS as a valid bit by adding
CR4_LASS_MASKto the known bits, i.e. clearing it fromCR4_RESERVED_MASK. Mark it reserved incr4_reserved_bits()and clear it incpu_x86_update_cr4()when the guest CPUID does not enumerate LASS. This keeps CR4 handling consistent on paths that reachcpu_x86_update_cr4(), such as gdbstub register writes.LASS is not emulated by TCG, so it is not added to
TCG_7_1_EAX_FEATURESand cannot be set under TCG (helper_write_crN()andhelper_vmrun()both reject reserved bits viacr4_reserved_bits()).
Quoted 7 lines
Signed-off-by Isaku Yamahata <[email protected]>[kishen: rewrote commit message, rebased, fixed formatting]Signed-off-by Kishen Maloor <[email protected]>--- target/i386/cpu.h | 7 ++++++- target/i386/helper.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-)
PATCH 3/5 target/i386: Introduce DiamondRapids-v3 to enable LASS
In reply to Kishen MaloorAdd DiamondRapids-v3 to expose Linear Address Space Separation (LASS) on the DiamondRapids CPU model.
--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/cpu.c +8 -0
@@ -5829,6 +5829,14 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ }, } }, + { + .version = 3, + .note = "with LASS", + .props = (PropValue[]) { + { "lass", "on" }, + { /* end of list */ }, + } + }, { /* end of list */ }, }, },
Signature · 1 line
2.47.1
Re: [PATCH 3/5] target/i386: Introduce DiamondRapids-v3 to enable LASS
Quoted 5 lines · Kishen Maloor
Date: Tue, 25 Aug 2026 20:57:32 -0700
From: Kishen Maloor <[email protected]>
Subject: [PATCH 3/5] target/i386: Introduce DiamondRapids-v3 to enable LASS
X-Mailer: git-send-email 2.47.1
Quoted 7 lines
Add DiamondRapids-v3 to expose Linear Address Space Separation (LASS) on the DiamondRapids CPU model.
Signed-off-by Kishen Maloor <[email protected]>--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH 4/5 target/i386: Introduce SierraForest-v7 to enable LASS
In reply to Kishen MaloorAdd SierraForest-v7 to expose Linear Address Space Separation (LASS) on the SierraForest CPU model.
--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/cpu.c +8 -0
@@ -6018,6 +6018,14 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ }, } }, + { + .version = 7, + .note = "with LASS", + .props = (PropValue[]) { + { "lass", "on" }, + { /* end of list */ }, + } + }, { /* end of list */ }, }, },
Signature · 1 line
2.47.1
Re: [PATCH 4/5] target/i386: Introduce SierraForest-v7 to enable LASS
Quoted 5 lines · Kishen Maloor
Date: Tue, 25 Aug 2026 20:57:33 -0700
From: Kishen Maloor <[email protected]>
Subject: [PATCH 4/5] target/i386: Introduce SierraForest-v7 to enable LASS
X-Mailer: git-send-email 2.47.1
Quoted 7 lines
Add SierraForest-v7 to expose Linear Address Space Separation (LASS) on the SierraForest CPU model.
Signed-off-by Kishen Maloor <[email protected]>--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH 5/5 target/i386: Introduce ClearwaterForest-v5 to enable LASS
In reply to Kishen MaloorAdd ClearwaterForest-v5 to expose Linear Address Space Separation (LASS) on the ClearwaterForest CPU model.
--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/cpu.c +8 -0
@@ -6190,6 +6190,14 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ }, } }, + { + .version = 5, + .note = "with LASS", + .props = (PropValue[]) { + { "lass", "on" }, + { /* end of list */ }, + } + }, { /* end of list */ }, }, },
Signature · 1 line
2.47.1
Re: [PATCH 5/5] target/i386: Introduce ClearwaterForest-v5 to enable LASS
Quoted 6 lines · Kishen Maloor
Date: Tue, 25 Aug 2026 20:57:34 -0700
From: Kishen Maloor <[email protected]>
Subject: [PATCH 5/5] target/i386: Introduce ClearwaterForest-v5 to enable
LASS
X-Mailer: git-send-email 2.47.1
Quoted 7 lines
Add ClearwaterForest-v5 to expose Linear Address Space Separation (LASS) on the ClearwaterForest CPU model.
Signed-off-by Kishen Maloor <[email protected]>--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 11 lines · Kishen Maloor
This series adds QEMU support for Linear Address Space Separation (LASS) [1], an Intel security feature that prevents a class of side-channel attacks relying on speculative accesses across the user/kernel boundary. Paging, along with SMEP and SMAP, already provides mode-based access protection, but enforcing it requires a page walk whose timing can leak the layout of kernel memory. LASS applies the equivalent protections during linear-address pre-processing: given the usual partitioning of the linear address space into a user half (bit 63 clear) and a supervisor half (bit 63 set), an access targeting the opposite half is rejected on the basis of bit 63 alone, before any page walk.
Quoted 8 lines
This series enumerates the LASS CPUID bit, recognizes CR4.LASS, and exposes LASS on the relevant Intel CPU models via new versioned models. LASS is not emulated by TCG.
Exposing LASS to a guest also requires KVM support: KVM must validate the CPUID bit and CR4.LASS, and enforce LASS violations in its instruction emulator. That enabling is currently under review [2].
I tested this series on Clearwater Forest (CWF), running a KVM guest with -cpu host. On the host I applied the KVM LASS enabling series referenced as [2] in the cover letter:
https://lore.kernel.org/kvm/[email protected]/
With both series applied, LASS is correctly enumerated in the guest, and the LASS functional tests pass with vsyscall=none/xonly/emulate.
Quoted 9 lines · Kishen Maloor
Isaku Yamahata (2):
target/i386: Add support for LASS in CPUID enumeration target/i386: Add LASS support in CR4Kishen Maloor (3):
target/i386: Introduce DiamondRapids-v3 to enable LASS target/i386: Introduce SierraForest-v7 to enable LASS target/i386: Introduce ClearwaterForest-v5 to enable LASS
Quoted 5 lines
target/i386/cpu.c | 26 +++++++++++++++++++++++++- target/i386/cpu.h | 7 ++++++- target/i386/helper.c | 4 ++++ 3 files changed, 35 insertions(+), 2 deletions(-)
Quoted 26 lines · Kishen Maloor
This series adds QEMU support for Linear Address Space Separation (LASS) [1], an Intel security feature that prevents a class of side-channel attacks relying on speculative accesses across the user/kernel boundary. Paging, along with SMEP and SMAP, already provides mode-based access protection, but enforcing it requires a page walk whose timing can leak the layout of kernel memory. LASS applies the equivalent protections during linear-address pre-processing: given the usual partitioning of the linear address space into a user half (bit 63 clear) and a supervisor half (bit 63 set), an access targeting the opposite half is rejected on the basis of bit 63 alone, before any page walk.
This series enumerates the LASS CPUID bit, recognizes CR4.LASS, and exposes LASS on the relevant Intel CPU models via new versioned models. LASS is not emulated by TCG.
Exposing LASS to a guest also requires KVM support: KVM must validate the CPUID bit and CR4.LASS, and enforce LASS violations in its instruction emulator. That enabling is currently under review [2].
Tested with a Linux guest on LASS-capable hardware: LASS is enumerated and CR4.LASS is set under KVM, and not enumerated under TCG.
[1] Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, Section 4.3, "Linear-Address-Space Separation (LASS)".
[2] https://lore.kernel.org/kvm/[email protected]/
Quoted 8 lines
Isaku Yamahata (2):
target/i386: Add support for LASS in CPUID enumeration target/i386: Add LASS support in CR4Kishen Maloor (3):
target/i386: Introduce DiamondRapids-v3 to enable LASS target/i386: Introduce SierraForest-v7 to enable LASS target/i386: Introduce ClearwaterForest-v5 to enable LASS
Quoted 6 lines
target/i386/cpu.c | 26 +++++++++++++++++++++++++- target/i386/cpu.h | 7 ++++++- target/i386/helper.c | 4 ++++ 3 files changed, 35 insertions(+), 2 deletions(-)