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: <10537.1455904440@turing-police.cc.vt.edu>
Date:	Fri, 19 Feb 2016 12:54:00 -0500
From:	Valdis.Kletnieks@...edu
To:	Aurelien Jarno <aurelien@...el32.net>
Cc:	Gleb Natapov <gleb@...nel.org>,
	Paolo Bonzini <pbonzini@...hat.com>, x86@...nel.org,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Aruna Hewapathirane <aruna.hewapathirane@...il.com>
Subject: Re: Silence compiler warning in arch/x86/kvm/emulate.c

On Fri, 19 Feb 2016 17:45:48 +0100, Aurelien Jarno said:
> On 2016-02-19 12:11, Aurelien Jarno wrote:


> Actually the same patch with a bit more context shows the issue:
>
> > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> > index e7a4fde..b372a75 100644
> > --- a/arch/x86/kvm/emulate.c
> > +++ b/arch/x86/kvm/emulate.c
> > @@ -647,12 +647,13 @@ static __always_inline int __linearize(struct x86_emu
late_ctxt *ctxt,
> >  	bool usable;
> >  	ulong la;
> >  	u32 lim;
> >  	u16 sel;
> >
> >  	la = seg_base(ctxt, addr.seg) + addr.ea;
> > +	*linear = la;
>
> The assignation is moved here...
>
> >  	*max_size = 0;
> >  	switch (mode) {
> >  	case X86EMUL_MODE_PROT64:
> >  		if (is_noncanonical_address(la))
> >  			goto bad;
> >
> > @@ -690,13 +691,12 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt,
> >  		}
> >  		la &= (u32)-1;
>
> ... while the value of la might be modified in between.

(trying to reconstruct my thought process from 6 months ago.  I remember
staring at that, and I convinced myself it was still OK to move the assignment.)

la can get changed here - but there's 2 cases to consider.  If it's in a 32-bit
kernel, anding with -1 is a no-op.

Now if we're on a 64-bit kernel, the 'and' clears the high 32 bits.

But under what conditions is 'la' a 64-bit quantity that has
any bits set in the high 32 bits (meaning it's a pointer to something
over the 4G line) - but it's still valid to smash those bits?



Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ