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] [day] [month] [year] [list]
Message-ID: <87tv873dof.fsf@vitty.brq.redhat.com>
Date:   Thu, 17 Oct 2019 11:48:48 +0200
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     linmiaohe <linmiaohe@...wei.com>
Cc:     "x86\@kernel.org" <x86@...nel.org>,
        "kvm\@vger.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        Mingfangsen <mingfangsen@...wei.com>,
        "pbonzini\@redhat.com" <pbonzini@...hat.com>,
        "rkrcmar\@redhat.com" <rkrcmar@...hat.com>,
        "sean.j.christopherson\@intel.com" <sean.j.christopherson@...el.com>,
        "wanpengli\@tencent.com" <wanpengli@...cent.com>,
        "jmattson\@google.com" <jmattson@...gle.com>,
        "joro\@8bytes.org" <joro@...tes.org>,
        "tglx\@linutronix.de" <tglx@...utronix.de>,
        "mingo\@redhat.com" <mingo@...hat.com>,
        "bp\@alien8.de" <bp@...en8.de>, "hpa\@zytor.com" <hpa@...or.com>
Subject: Re: [PATCH] KVM: SVM: Fix potential wrong physical id in avic_handle_ldr_update

linmiaohe <linmiaohe@...wei.com> writes:

> Vitaly Kuznetsov <vkuznets@...hat.com> writes:
>
>>> Guest physical APIC ID may not equal to vcpu->vcpu_id in some case.
>>> We may set the wrong physical id in avic_handle_ldr_update as we 
>>> always use vcpu->vcpu_id.
>
> Hi, Vitaly, thanks for your reply.
> Do you think there may be a wrong physical id in
> avic_handle_ldr_update too ?

Honestly I'm not sure, however, as we need to put physical id to LDR
we'd rather get it from LAPIC then assume that it's == vcpu_id so I
think your patch makes sense even if it fixes a theoretical issue.

But I may be missing something important about AVIC.

>
>>>
>>> @@ -4591,6 +4591,8 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)
>>>  	int ret = 0;
>>>  	struct vcpu_svm *svm = to_svm(vcpu);
>>>  	u32 ldr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_LDR);
>>> +	u32 apic_id_reg = kvm_lapic_get_reg(vcpu->arch.apic, APIC_ID);
>>> +	u32 id = (apic_id_reg >> 24) & 0xff;
>>
>>If we reach here than we're guaranteed to be in xAPIC mode, right? Could you maybe export and use kvm_xapic_id() here then (and in
>>avic_handle_apic_id_update() too)?
>>
>
> I think we're guaranteed to be in xAPIC mode when we reach here. I would have a try to export
> and use use kvm_xapic_id here and in avic_handle_apic_id_update too.
> Thanks for your suggestion.
>
> Have a nice day.
> Best wishes.

-- 
Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ