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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250318153316.1970147-9-chao.gao@intel.com>
Date: Tue, 18 Mar 2025 23:31:58 +0800
From: Chao Gao <chao.gao@...el.com>
To: x86@...nel.org,
	linux-kernel@...r.kernel.org,
	kvm@...r.kernel.org,
	tglx@...utronix.de,
	dave.hansen@...el.com,
	seanjc@...gle.com,
	pbonzini@...hat.com
Cc: peterz@...radead.org,
	rick.p.edgecombe@...el.com,
	weijiang.yang@...el.com,
	john.allen@....com,
	bp@...en8.de,
	chang.seok.bae@...el.com,
	xin3.li@...el.com,
	Chao Gao <chao.gao@...el.com>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Aruna Ramakrishna <aruna.ramakrishna@...cle.com>,
	Mitchell Levy <levymitchell0@...il.com>,
	Adamos Ttofari <attofari@...zon.de>,
	Uros Bizjak <ubizjak@...il.com>
Subject: [PATCH v4 8/8] x86/fpu/xstate: Warn if guest-only supervisor states are detected in normal fpstate

From: Yang Weijiang <weijiang.yang@...el.com>

guest-only supervisor state bits should be __ONLY__ enabled for guest
fpstate, i.e., never for normal kernel fpstate. WARN_ONCE() if normal
kernel fpstate sees any of these features.

Signed-off-by: Yang Weijiang <weijiang.yang@...el.com>
Signed-off-by: Chao Gao <chao.gao@...el.com>
---
 arch/x86/kernel/fpu/xstate.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
index 1418423bc4c9..f644647c0549 100644
--- a/arch/x86/kernel/fpu/xstate.h
+++ b/arch/x86/kernel/fpu/xstate.h
@@ -208,6 +208,8 @@ static inline void os_xsave(struct fpstate *fpstate)
 	WARN_ON_FPU(!alternatives_patched);
 	xfd_validate_state(fpstate, mask, false);
 
+	WARN_ON_FPU(!fpstate->is_guest && (mask & XFEATURE_MASK_SUPERVISOR_GUEST));
+
 	XSTATE_XSAVE(&fpstate->regs.xsave, lmask, hmask, err);
 
 	/* We should never fault when copying to a kernel buffer: */
-- 
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ