Re: [PATCH 3/7] x86/cpu: Disable kernel LASS when patching kernel alternatives

From: Sohil Mehta
Date: Tue Jan 10 2023 - 17:41:51 EST


On 1/9/2023 9:52 PM, Yian Chen wrote:

LASS stops access to a lower half address in kernel,
and this can be deactivated if AC bit in EFLAGS
register is set. Hence use stac and clac instructions
around access to the address to avoid triggering a
LASS #GP fault.


It seems we are implicitly relying on the on stac() and clac() calls that are added for SMAP. Have you tried running with SMAP disabled i.e "clearcpuid=smap"?

I believe there needs to be a dependency between LASS and SMAP.

diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
index d95221117129..00bc7e4a65d2 100644
--- a/arch/x86/kernel/cpu/cpuid-deps.c
+++ b/arch/x86/kernel/cpu/cpuid-deps.c
@@ -79,6 +79,7 @@ static const struct cpuid_dep cpuid_deps[] = {
{ X86_FEATURE_XFD, X86_FEATURE_XSAVES },
{ X86_FEATURE_XFD, X86_FEATURE_XGETBV1 },
{ X86_FEATURE_AMX_TILE, X86_FEATURE_XFD },
+ { X86_FEATURE_LASS, X86_FEATURE_SMAP },
{}
};