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]
Date:   Sat, 9 Dec 2017 07:42:03 +0000
From:   "Sironi, Filippo" <sironi@...zon.de>
To:     Paolo Bonzini <pbonzini@...hat.com>
CC:     "rkrcmar@...hat.com" <rkrcmar@...hat.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] KVM: x86: Allow userspace to define what's the
 microcode version


> On 27. Nov 2017, at 03:58, Paolo Bonzini <pbonzini@...hat.com> wrote:
> 
> On 26/11/2017 17:41, Filippo Sironi wrote:
>> ... that the guest should see.
>> Guest operating systems may check the microcode version to decide whether
>> to disable certain features that are known to be buggy up to certain
>> microcode versions.  Address the issue by making the microcode version
>> that the guest should see settable.
>> The rationale for having userspace specifying the microcode version, rather
>> than having the kernel picking it, is to ensure consistency for live-migrated
>> instances; we don't want them to see a microcode version increase without a
>> reset.
>> 
>> Signed-off-by: Filippo Sironi <sironi@...zon.de>
>> ---
>> arch/x86/kvm/x86.c       | 23 +++++++++++++++++++++++
>> include/uapi/linux/kvm.h |  3 +++
>> 2 files changed, 26 insertions(+)
>> 
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 925c3e29cad3..741588f27ebc 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -4033,6 +4033,29 @@ long kvm_arch_vm_ioctl(struct file *filp,
>> 	} u;
>> 
>> 	switch (ioctl) {
>> +	case KVM_GET_MICROCODE_VERSION: {
>> +		r = -EFAULT;
>> +		if (copy_to_user(argp,
>> +				 &kvm->arch.microcode_version,
>> +				 sizeof(kvm->arch.microcode_version)))
>> +			goto out;
>> +		break;
>> +	}
>> +	case KVM_SET_MICROCODE_VERSION: {
>> +		u32 microcode_version;
>> +
>> +		r = -EFAULT;
>> +		if (copy_from_user(&microcode_version,
>> +				   argp,
>> +				   sizeof(microcode_version)))
>> +			goto out;
>> +		r = -EINVAL;
>> +		if (!microcode_version)
>> +			goto out;
>> +		kvm->arch.microcode_version = microcode_version;
>> +		r = 0;
>> +		break;
>> +	}
> 
> Also, there's no need to define new ioctls, instead you can just place
> it in the vcpu and use KVM_GET_MSR/KVM_SET_MSR.  I'd agree that's
> slightly less polished, but it matches what we do already for e.g.
> nested VMX model specific registers.  And it spares you for writing the
> documentation that you didn't include in this patch. :)
> 
> Paolo

I wanted to do the work once rather than doing it per vCPU but using
KVM_{GET|SET}_MSR and extending the list of MSRs that userspace can
save/restore is certainly doable.

I'll look into that and post a v2.

Filippo

Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ