lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240403062404.2956240-1-xin@zytor.com>
Date: Tue,  2 Apr 2024 23:24:03 -0700
From: "Xin Li (Intel)" <xin@...or.com>
To: linux-kernel@...r.kernel.org
Cc: luto@...nel.org, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
        brgerst@...il.com
Subject: [PATCH v1 1/1] x86/entry/64: Skip SYSRET validation tests when FRED is enabled

Don't do SYSRET validation tests when FRED is enabled, since ERETU is
the only legit instruction to return to user level.

Signed-off-by: Xin Li (Intel) <xin@...or.com>
---
 arch/x86/entry/common.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 6356060caaf3..1c3944eb9901 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -72,7 +72,7 @@ static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr)
 	return false;
 }
 
-/* Returns true to return using SYSRET, or false to use IRET */
+/* Returns true to return using SYSRET, or false to use IRET/ERETU */
 __visible noinstr bool do_syscall_64(struct pt_regs *regs, int nr)
 {
 	add_random_kstack_offset();
@@ -88,6 +88,10 @@ __visible noinstr bool do_syscall_64(struct pt_regs *regs, int nr)
 	instrumentation_end();
 	syscall_exit_to_user_mode(regs);
 
+	/* No test for FRED, which returns to user level with ERETU only */
+	if (cpu_feature_enabled(X86_FEATURE_FRED))
+		return false;
+
 	/*
 	 * Check that the register state is valid for using SYSRET to exit
 	 * to userspace.  Otherwise use the slower but fully capable IRET
@@ -325,7 +329,7 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
 	return true;
 }
 
-/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */
+/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET/ERETU */
 __visible noinstr bool do_fast_syscall_32(struct pt_regs *regs)
 {
 	/*
@@ -346,6 +350,10 @@ __visible noinstr bool do_fast_syscall_32(struct pt_regs *regs)
 	if (!__do_fast_syscall_32(regs))
 		return false;
 
+	/* No test for FRED, which returns to user level with ERETU only */
+	if (cpu_feature_enabled(X86_FEATURE_FRED))
+		return false;
+
 	/*
 	 * Check that the register state is valid for using SYSRETL/SYSEXIT
 	 * to exit to userspace.  Otherwise use the slower but fully capable

base-commit: 65d1240b6728b38e4d2068d6738a17e4ee4351f5
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ