]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/vsyscall: Disable LASS if vsyscall mode is set to EMULATE
authorSohil Mehta <sohil.mehta@intel.com>
Mon, 9 Mar 2026 18:10:28 +0000 (11:10 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Thu, 19 Mar 2026 22:11:13 +0000 (15:11 -0700)
The EMULATE mode of vsyscall maps the vsyscall page with a high kernel
address directly into user address space. Reading the vsyscall page in
EMULATE mode would cause LASS to trigger a #GP.

Fixing the LASS violation in EMULATE mode would require complex
instruction decoding because the resulting #GP does include the
necessary error information, and the vsyscall address is not
readily available in the RIP.

The EMULATE mode has been deprecated since 2022 and can only be enabled
using the command line parameter vsyscall=emulate. See commit
bf00745e7791 ("x86/vsyscall: Remove CONFIG_LEGACY_VSYSCALL_EMULATE") for
details. At this point, no one is expected to be using this insecure
mode. The rare usages that need it obviously do not care about security.

Disable LASS when EMULATE mode is requested to avoid breaking legacy
user software. Also, update the vsyscall documentation to reflect this.
LASS will only be supported if vsyscall mode is set to XONLY (default)
or NONE.

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Tested-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Link: https://patch.msgid.link/20260309181029.398498-5-sohil.mehta@intel.com
Documentation/admin-guide/kernel-parameters.txt
arch/x86/entry/vsyscall/vsyscall_64.c

index cb850e5290c2ba9404a4bcbeb07d89c439e287c4..64df2c52b2e51f889b5ed6f41154a58666b2a458 100644 (file)
@@ -8376,7 +8376,9 @@ Kernel parameters
 
                        emulate     Vsyscalls turn into traps and are emulated
                                    reasonably safely.  The vsyscall page is
-                                   readable.
+                                   readable.  This disables the Linear
+                                   Address Space Separation (LASS) security
+                                   feature and makes the system less secure.
 
                        xonly       [default] Vsyscalls turn into traps and are
                                    emulated reasonably safely.  The vsyscall
index e740f3b422788dcbf1e87c09856d7502858a5d9c..ea36de9fa8641d5e306b7f8d2414ae1810c0eca0 100644 (file)
@@ -62,6 +62,11 @@ static int __init vsyscall_setup(char *str)
                else
                        return -EINVAL;
 
+               if (cpu_feature_enabled(X86_FEATURE_LASS) && vsyscall_mode == EMULATE) {
+                       setup_clear_cpu_cap(X86_FEATURE_LASS);
+                       pr_warn_once("x86/cpu: Disabling LASS due to vsyscall=emulate\n");
+               }
+
                return 0;
        }