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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428018736.31093.102.camel@misato.fc.hp.com>
Date:	Thu, 02 Apr 2015 17:52:16 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	"Luis R. Rodriguez" <mcgrof@...e.com>
Cc:	"Luis R. Rodriguez" <mcgrof@...not-panic.com>, luto@...capital.net,
	mingo@...hat.com, tglx@...utronix.de, hpa@...or.com,
	jgross@...e.com, JBeulich@...e.com, bp@...e.de,
	suresh.b.siddha@...el.com, venkatesh.pallipadi@...el.com,
	airlied@...hat.com, linux-kernel@...r.kernel.org,
	linux-fbdev@...r.kernel.org, x86@...nel.org,
	xen-devel@...ts.xenproject.org, Ingo Molnar <mingo@...e.hu>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	Antonino Daplas <adaplas@...il.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	Tomi Valkeinen <tomi.valkeinen@...com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Stefan Bader <stefan.bader@...onical.com>,
	konrad.wilk@...cle.com, ville.syrjala@...ux.intel.com,
	david.vrabel@...rix.com, bhelgaas@...gle.com,
	Roger Pau Monné <roger.pau@...rix.com>,
	xen-devel@...ts.xensource.com
Subject: Re: [PATCH v1 02/47] x86: mtrr: generalize run time disabling of
 MTRR

On Thu, 2015-04-02 at 23:49 +0200, Luis R. Rodriguez wrote:
> On Sat, Mar 28, 2015 at 12:56:30AM +0100, Luis R. Rodriguez wrote:
> > On Fri, Mar 27, 2015 at 02:40:17PM -0600, Toshi Kani wrote:
> > > On Fri, 2015-03-20 at 16:17 -0700, Luis R. Rodriguez wrote:
> > >  :
> > > > @@ -734,6 +742,7 @@ void __init mtrr_bp_init(void)
> > > >  	}
> > > >  
> > > >  	if (mtrr_if) {
> > > > +		mtrr_enabled = true;
> > > >  		set_num_var_ranges();
> > > >  		init_table();
> > > >  		if (use_intel()) {
> > >                         get_mtrr_state();
> > > 
> > > After setting mtrr_enabled to true, get_mtrr_state() reads
> > > MSR_MTRRdefType and sets 'mtrr_state.enabled', which also indicates if
> > > MTRRs are enabled or not on the system.  So, potentially, we could have
> > > a case that mtrr_enabled is set to true, but mtrr_state.enabled is set
> > > to disabled when MTRRs are disabled by BIOS.
> > 
> > Thanks for the review, in this case then we should update mtrr_enabled to false.
> > 
> > > ps.
> > > I recently cleaned up this part of the MTRR code in the patch below,
> > > which is currently available in the -mm & -next trees.
> > > https://lkml.org/lkml/2015/3/24/1063
> > 
> > Great I will rebase and work with that and try to address this
> > consideration you have raised.
> 
> OK I'll mesh in this change as well in my next respin:
> 
> diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
> index a83f27a..ecf7cb9 100644
> --- a/arch/x86/kernel/cpu/mtrr/generic.c
> +++ b/arch/x86/kernel/cpu/mtrr/generic.c
> @@ -438,7 +438,7 @@ static void __init print_mtrr_state(void)
>  }
>  
>  /* Grab all of the MTRR state for this CPU into *state */
> -void __init get_mtrr_state(void)
> +bool __init get_mtrr_state(void)
>  {
>  	struct mtrr_var_range *vrs;
>  	unsigned long flags;
> @@ -482,6 +482,8 @@ void __init get_mtrr_state(void)
>  
>  	post_set();
>  	local_irq_restore(flags);
> +
> +	return !!mtrr_state.enabled;

This should be:
	return mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED;

because the MTRR_STATE_MTRR_FIXED_ENABLED flag is ignored when the
MTRR_STATE_MTRR_ENABLED flag is clear.

Thanks,
-Toshi



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ