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: <e5744e0b-00fc-8563-edb7-b6bf52c63b0e@redhat.com>
Date:   Mon, 24 Jan 2022 17:29:31 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>,
        Like Xu <like.xu.linux@...il.com>
Cc:     "Tian, Kevin" <kevin.tian@...el.com>,
        "Liu, Jing2" <jing2.liu@...el.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Joerg Roedel <joro@...tes.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Zhong, Yang" <yang.zhong@...el.com>
Subject: Re: [PATCH] KVM: x86/cpuid: Exclude unpermitted xfeatures for
 vcpu->arch.guest_supported_xcr0

On 1/24/22 17:23, Sean Christopherson wrote:
> On Mon, Jan 24, 2022, Like Xu wrote:
>> On 24/1/2022 3:06 pm, Tian, Kevin wrote:
>>>> From: Like Xu <like.xu.linux@...il.com>
>>>> Sent: Sunday, January 23, 2022 1:50 PM
>>>>
>>>> From: Like Xu <likexu@...cent.com>
>>>>
>>>> A malicious user space can bypass xstate_get_guest_group_perm() in the
>>>> KVM_GET_SUPPORTED_CPUID mechanism and obtain unpermitted xfeatures,
>>>> since the validity check of xcr0 depends only on guest_supported_xcr0.
>>>
>>> Unpermitted xfeatures cannot pass kvm_check_cpuid()...
>>
>> Indeed, 5ab2f45bba4894a0db4af8567da3efd6228dd010.
>>
>> This part of logic is pretty fragile and fragmented due to semantic
>> inconsistencies between supported_xcr0 and guest_supported_xcr0
>> in other three places:
> 
> There are no inconsistencies, at least not in the examples below, as the examples
> are intended to work in host context.  guest_supported_xcr0 is about what the guest
> is/isn't allowed to access, it has no bearing on what host userspace can/can't do.
> Or are you talking about a different type of inconsistency?

The extra complication is that arch_prctl(ARCH_REQ_XCOMP_GUEST_PERM) 
changes what host userspace can/can't do.  It would be easier if we 
could just say that KVM_GET_SUPPORTED_CPUID returns "the most" that 
userspace can do, but we already have the contract that userspace can
take KVM_GET_SUPPORTED_CPUID and pass it straight to KVM_SET_CPUID2.

Therefore,  KVM_GET_SUPPORTED_CPUID must limit its returned values to 
what has already been enabled.

While reviewing the QEMU part of AMX support (this morning), I also 
noticed that there is no equivalent for guest permissions of 
ARCH_GET_XCOMP_SUPP.  This needs to know KVM's supported_xcr0, so it's 
probably best realized as a new KVM_CHECK_EXTENSION rather than as an 
arch_prctl.

Paolo

>> - __do_cpuid_func
> 
> Reporting what KVM supports to host userspace.
> 
>> - kvm_mpx_supported
> 
> This is a check on host support.
> 
>> - kvm_vcpu_ioctl_x86_set_xsave
> 
> "write" from host userspace.
> 
>> Have you identified all their areas of use ?
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ