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: <20230621120942.121822-5-chang.seok.bae@intel.com>
Date:   Wed, 21 Jun 2023 05:09:42 -0700
From:   "Chang S. Bae" <chang.seok.bae@...el.com>
To:     linux-kernel@...r.kernel.org, x86@...nel.org
Cc:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, hpa@...or.com,
        andrew.cooper3@...rix.com, chang.seok.bae@...el.com
Subject: [PATCH v1 4/4] x86/fpu: Remove the unnecessary fpstate_reset() invocation

fpstate_reset() initializes the fpstate container. But, when no state
has been established yet, calling this is not meaningful. In the
fpu__init_system() function, it is called immediately after the legacy
FPU size is determined. So, remove it as not causing any issues.

Signed-off-by: Chang S. Bae <chang.seok.bae@...el.com>
Cc: x86@...nel.org
Cc: linux-kernel@...r.kernel.org
---

The change made by fpstate_reset() can be measured with this:

static struct fpstate fps;

void __init fpu__init_system(struct cpuinfo_x86 *c)
{
	memcpy(&fps, &current->thread.fpu.__fpstate, sizeof(struct fpstate));
	fpstate_reset(&current->thread.fpu);
	if (memcmp(&fps, &current->thread.fpu.__fpstate, sizeof(struct fpstate)))
		pr_info("fpstate has reason to be inited at %s\n", __func__);
	else
		pr_info("fpstate has no reason to be inited at %s\n", __func__);
	...
}

Although it looks to be a no-op, there might be some unknown
intention behind it. If there is a specific reason for invoking
fpstate_reset() at that point, this should be documented properly
instead of removing it.
---
 arch/x86/kernel/fpu/init.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c
index 998a08f17e33..95af3084c4cf 100644
--- a/arch/x86/kernel/fpu/init.c
+++ b/arch/x86/kernel/fpu/init.c
@@ -213,7 +213,6 @@ static void __init fpu__init_system_xstate_size_legacy(void)
  */
 void __init fpu__init_system(void)
 {
-	fpstate_reset(&current->thread.fpu);
 	fpu__init_system_early_generic();
 
 	/*
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ