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: <20200403174403.306363-2-benjamin.lamowski@kernkonzept.com>
Date:   Fri,  3 Apr 2020 19:44:03 +0200
From:   Benjamin Lamowski <benjamin.lamowski@...nkonzept.com>
To:     xiaoyao.li@...el.com
Cc:     philipp.eppelt@...nkonzept.com, bp@...en8.de, fenghua.yu@...el.com,
        hpa@...or.com, linux-kernel@...r.kernel.org, luto@...nel.org,
        mingo@...hat.com, nivedita@...m.mit.edu, pbonzini@...hat.com,
        peterz@...radead.org, sean.j.christopherson@...el.com,
        tglx@...utronix.de, tony.luck@...el.com, x86@...nel.org,
        Benjamin Lamowski <benjamin.lamowski@...nkonzept.com>
Subject: [PATCH 1/1] x86/split_lock: check split lock feature on initialization

While the setup code probes for the availability of the TEST_CTRL MSR,
the current initialization code unconditionally probes it even on
systems where this architectural MSR is not available.

This commit changes the code to check for the availability of the split
lock detect feature before initializing it.

Fixes: dbaba47085b0c ("x86/split_lock: Rework the initialization flow of split lock detection")
Signed-off-by: Benjamin Lamowski <benjamin.lamowski@...nkonzept.com>
---
 arch/x86/kernel/cpu/intel.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9a26e972cdea..70d338ff4807 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -586,7 +586,7 @@ static void init_intel_misc_features(struct cpuinfo_x86 *c)
 	wrmsrl(MSR_MISC_FEATURES_ENABLES, msr);
 }
 
-static void split_lock_init(void);
+static void split_lock_init(struct cpuinfo_x86 *c);
 
 static void init_intel(struct cpuinfo_x86 *c)
 {
@@ -703,7 +703,7 @@ static void init_intel(struct cpuinfo_x86 *c)
 	if (tsx_ctrl_state == TSX_CTRL_DISABLE)
 		tsx_disable();
 
-	split_lock_init();
+	split_lock_init(c);
 }
 
 #ifdef CONFIG_X86_32
@@ -1061,9 +1061,10 @@ static void sld_update_msr(bool on)
 	wrmsrl(MSR_TEST_CTRL, test_ctrl_val);
 }
 
-static void split_lock_init(void)
+static void split_lock_init(struct cpuinfo_x86 *c)
 {
-	split_lock_verify_msr(sld_state != sld_off);
+	if (cpu_has(c, X86_FEATURE_SPLIT_LOCK_DETECT))
+		split_lock_verify_msr(sld_state != sld_off);
 }
 
 bool handle_user_split_lock(struct pt_regs *regs, long error_code)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ