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]
Date: Sat, 4 May 2024 14:50:40 +0200
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>,
	kernel test robot <oliver.sang@...el.com>
Cc: oe-lkp@...ts.linux.dev, lkp@...el.com, linux-kernel@...r.kernel.org,
	x86@...nel.org, Ingo Molnar <mingo@...nel.org>,
	Srikanth Aithal <sraithal@....com>
Subject: [PATCH 2/2] x86/CPU/Intel: Do the MSR_IA32_FEAT_CTL setup before
 alternatives

From: "Borislav Petkov (AMD)" <bp@...en8.de>
Date: Thu, 2 May 2024 15:15:41 +0200

init_ia32_feat_ctl() goes through the MSR_IA32_FEAT_CTL settings and
sanity-checks the configuration on each logical CPU, while setting or
clearing X86_FEATURE flags in the process.

However, it does that after alternatives have run, leading to settings
which have been patched by the alternatives to become invalid and
irreversible.

Move the settings detection to an earlier path, before the alternatives.

Reported-by: kernel test robot <oliver.sang@...el.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://lore.kernel.org/oe-lkp/202404302233.f27f91b2-oliver.sang@intel.com
---
 arch/x86/kernel/cpu/intel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index be30d7fa2e66..d8575511a143 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -406,6 +406,8 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	 */
 	if (cpu_has(c, X86_FEATURE_TME))
 		detect_tme_early(c);
+
+	init_ia32_feat_ctl(c);
 }
 
 static void bsp_init_intel(struct cpuinfo_x86 *c)
@@ -682,8 +684,6 @@ static void init_intel(struct cpuinfo_x86 *c)
 	/* Work around errata */
 	srat_detect_node(c);
 
-	init_ia32_feat_ctl(c);
-
 	init_intel_misc_features(c);
 
 	split_lock_init();
-- 
2.43.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ