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, 22 Dec 2020 23:49:15 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     David Laight <David.Laight@...LAB.COM>,
        'Sean Christopherson' <seanjc@...gle.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "syzbot+e87846c48bf72bc85311@...kaller.appspotmail.com" 
        <syzbot+e87846c48bf72bc85311@...kaller.appspotmail.com>
Subject: Re: [PATCH] KVM: x86: fix shift out of bounds reported by UBSAN

On 22/12/20 19:31, David Laight wrote:
>> 	/*
>> 	 * Use 2ULL to incorporate the necessary +1 in the shift; adding +1 in
>> 	 * the shift count will overflow SHL's max shift of 63 if s=0 and e=63.
>> 	 */
> A comment of the desired output value would be more use.
> I think it is:
> 	return 'e-s' ones followed by 's' zeros without shifting by 64.
> 

What about a mix of the two:

	/*
	 * Return 'e-s' ones followed by 's' zeros.  Note that the
	 * apparently obvious 1ULL << (e - s + 1) can shift by 64 if
	 * s=0 and e=63, which is undefined behavior.
	 */

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ