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: <174634885768.22196.8535762687259029868.tip-bot2@tip-bot2>
Date: Sun, 04 May 2025 08:54:16 -0000
From: "tip-bot2 for Oleg Nesterov" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...nel.org>,
 "Chang S . Bae" <chang.seok.bae@...el.com>, "H. Peter Anvin" <hpa@...or.com>,
 Andy Lutomirski <luto@...capital.net>, Brian Gerst <brgerst@...il.com>,
 Linus Torvalds <torvalds@...ux-foundation.org>,
 Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: x86/fpu] x86/fpu: Shift fpregs_assert_state_consistent() from
 arch_exit_work() to its caller

The following commit has been merged into the x86/fpu branch of tip:

Commit-ID:     46c158e3ad0fc633007802c338c409c188ec0a12
Gitweb:        https://git.kernel.org/tip/46c158e3ad0fc633007802c338c409c188ec0a12
Author:        Oleg Nesterov <oleg@...hat.com>
AuthorDate:    Sat, 03 May 2025 16:39:02 +02:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Sun, 04 May 2025 10:29:25 +02:00

x86/fpu: Shift fpregs_assert_state_consistent() from arch_exit_work() to its caller

If CONFIG_X86_DEBUG_FPU=Y, arch_exit_to_user_mode_prepare() calls
arch_exit_work() even if ti_work == 0. There only reason is that we
want to call fpregs_assert_state_consistent() if TIF_NEED_FPU_LOAD
is not set.

This looks confusing. arch_exit_to_user_mode_prepare() can just call
fpregs_assert_state_consistent() unconditionally, it depends on
CONFIG_X86_DEBUG_FPU and checks TIF_NEED_FPU_LOAD itself.

Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Chang S . Bae <chang.seok.bae@...el.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: https://lore.kernel.org/r/20250503143902.GA9012@redhat.com
---
 arch/x86/include/asm/entry-common.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/entry-common.h b/arch/x86/include/asm/entry-common.h
index 77d2055..d535a97 100644
--- a/arch/x86/include/asm/entry-common.h
+++ b/arch/x86/include/asm/entry-common.h
@@ -53,7 +53,6 @@ static inline void arch_exit_work(unsigned long ti_work)
 	if (unlikely(ti_work & _TIF_IO_BITMAP))
 		tss_update_io_bitmap();
 
-	fpregs_assert_state_consistent();
 	if (unlikely(ti_work & _TIF_NEED_FPU_LOAD))
 		switch_fpu_return();
 }
@@ -61,7 +60,9 @@ static inline void arch_exit_work(unsigned long ti_work)
 static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
 						  unsigned long ti_work)
 {
-	if (IS_ENABLED(CONFIG_X86_DEBUG_FPU) || unlikely(ti_work))
+	fpregs_assert_state_consistent();
+
+	if (unlikely(ti_work))
 		arch_exit_work(ti_work);
 
 	fred_update_rsp0();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ