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:   Tue, 9 Apr 2019 17:02:31 -0700
From:   Fenghua Yu <fenghua.yu@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        H Peter Anvin <hpa@...or.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Ashok Raj <ashok.raj@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Kalle Valo <kvalo@...eaurora.org>,
        Xiaoyao Li <xiaoyao.li@...el.com>,
        Michael Chan <michael.chan@...adcom.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        x86 <x86@...nel.org>, linux-wireless@...r.kernel.org,
        netdev@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH v6 13/20] x86/split_lock: Enable split lock detection by
 default

On Thu, Apr 04, 2019 at 08:07:57PM +0200, Thomas Gleixner wrote:
> On Wed, 3 Apr 2019, Fenghua Yu wrote:
> 
> > +static void init_split_lock_detect(struct cpuinfo_x86 *c)
> > +{
> > +	if (cpu_has(c, X86_FEATURE_SPLIT_LOCK_DETECT)) {
> > +		u32 l, h;
> > +
> > +		mutex_lock(&split_lock_detect_mutex);
> > +		rdmsr(MSR_TEST_CTL, l, h);
> > +		l = new_sp_test_ctl_val(l);
> > +		wrmsr(MSR_TEST_CTL, l, h);
> > +		show_split_lock_detection_info();
> > +		mutex_unlock(&split_lock_detect_mutex);
> > +	}
> > +}
> > +
> >  static void early_init_intel(struct cpuinfo_x86 *c)
> >  {
> >  	u64 misc_enable;
> >  
> > +	init_split_lock_detect(c);
> 
> so we have in early boot:
> 
> 	early_cpu_init()
> 	  early_identify_cpu()
> 	    this_cpu->c_early_init(c)
> 	      early_init_intel() {
> 	        init_split_lock_detect();
> 	      }	
>             ....
>             cpu_set_core_cap_bits(c)
> 	       set(FEATURE_SPLIT_LOCK)
> 
> I don't have to understand how init_split_lock_detect() will magically see
> the feature bit which gets set afterwards, right? 

early_init_intel() is called twice on the boot CPU. Besides it's called
in earl_cpu_init(), it's also called in:
	identify_boot_cpu()
		identify_cpu()
			init_intel()
				early_init_intel()
					init_split_lock_detect();

It's true that init_split_lock_detect() doesn't see the feature bit when
it's called for the first time in early_cpu_init(). But it sees the feature
bit when it's called for the second time in identify_boot_cpu().

So is init_split_lock_detect() in the right place?

Thanks.

-Fenghua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ