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: <f027aa22-b7ee-88a4-4b1d-6bef77bd5a16@redhat.com>
Date:   Mon, 5 Sep 2016 15:27:23 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Yury Norov <ynorov@...iumnetworks.com>,
        Jan Dakinevich <jan.dakinevich@...il.com>
Cc:     kvm@...r.kernel.org, rkrcmar@...hat.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: nVMX: expose INS/OUTS information support



On 05/09/2016 11:19, Yury Norov wrote:
>> >  
>> > +static inline bool cpu_has_vmx_basic_inout(void)
> inline is useless. See Documentation/CodingStyle, Chapter 15

No, it's not.  See Documentation/CodingStyle, Chapter 15: "While the use
of inlines can be appropriate (for example as a means of replacing
macros, see Chapter 12), it very often is not".

>> > +{
>> > +	return	(((u64)vmcs_config.basic_cap << 32) & VMX_BASIC_INOUT);
> You can shift VMX_BASIC_INOUT (at compile time) and avoid the shifting of 
> vmcs_config.basic_cap at runtime.

Not really since VMX_BASIC_INOUT comes from the processor manual.

It's ironic that your first remark places a lot of trust in the
compiler, while the second places none.  The compiler is happy to
optimize away the left-shift/bitwise-AND pair to this:

	movq	%rdi, %rax
	shrq	$22, %rax
	andl	$1, %eax

where 22 is the order of VMX_BASIC_INOUT's only set bit, minus 32.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ