Re: [PATCH v4 3/7] KVM: x86: Add LASS violation checks during instruction emulation

From: Binbin Wu

Date: Wed Aug 19 2026 - 02:00:28 EST


On 8/6/2026 9:15 AM, Sohil Mehta wrote:
> From: Zeng Guang <guang.zeng@xxxxxxxxx>
>
> When Linear Address Space Separation (LASS) is enabled, the processor
> applies a LASS violation check on every access to a linear address. To
> align with hardware behavior, KVM needs to perform the same check during
> instruction emulation before consulting the page tables.
>
> Add a new callback to x86_emulate_ops to let the emulator query whether
> an access would trigger a LASS violation. The callback takes the linear
> address and the size that describe the memory access, plus a set of
> flags that convey the type of access.
>
> Add the LASS violation check to __linearize() so that every explicit
> guest memory access is validated along with the other linear address
> checks. The SDM (June 2026), Vol3, Chapter 4, specifically states that
> there is no relative ordering between the canonicality check and the
> LASS violation check. Also, there is no prioritization specified between
> the faults generated by alignment checks and LASS violations.
>
> Implicit supervisor accesses bypass __linearize(). So, add LASS checks
> for those in linear_read_system() and linear_write_system() and tag the
> access as implicit.
>
> For now, emulator_is_lass_violation() is a no-op. Later, it will be
> wired up to the VMX implementation.
>
> Signed-off-by: Zeng Guang <guang.zeng@xxxxxxxxx>
> Signed-off-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>

My SoB can be dropped.

> Signed-off-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>

Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>