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
| ||
|
Date: Mon, 7 Feb 2022 17:54:31 +0200 From: Maxim Levitsky <mlevitsk@...hat.com> To: kvm@...r.kernel.org Cc: Tony Luck <tony.luck@...el.com>, "Chang S. Bae" <chang.seok.bae@...el.com>, Thomas Gleixner <tglx@...utronix.de>, Wanpeng Li <wanpengli@...cent.com>, Ingo Molnar <mingo@...hat.com>, Vitaly Kuznetsov <vkuznets@...hat.com>, Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Dave Hansen <dave.hansen@...ux.intel.com>, Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org, Rodrigo Vivi <rodrigo.vivi@...el.com>, "H. Peter Anvin" <hpa@...or.com>, intel-gvt-dev@...ts.freedesktop.org, Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, Sean Christopherson <seanjc@...gle.com>, David Airlie <airlied@...ux.ie>, Zhi Wang <zhi.a.wang@...el.com>, Brijesh Singh <brijesh.singh@....com>, Jim Mattson <jmattson@...gle.com>, x86@...nel.org, Daniel Vetter <daniel@...ll.ch>, Borislav Petkov <bp@...en8.de>, Zhenyu Wang <zhenyuw@...ux.intel.com>, Kan Liang <kan.liang@...ux.intel.com>, Jani Nikula <jani.nikula@...ux.intel.com>, Maxim Levitsky <mlevitsk@...hat.com> Subject: [PATCH RESEND 14/30] KVM: x86: lapic: don't allow to change local apic id when using older x2apic api KVM allowed to set non boot apic id via setting apic state if using older non x2apic 32 bit apic id userspace api. Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com> --- arch/x86/kvm/lapic.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 7ff695cab27b2..aeddd68d31181 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2592,15 +2592,15 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu, if (enable_apicv && (*id >> 24) != vcpu->vcpu_id) return -EINVAL; } else { - if (vcpu->kvm->arch.x2apic_format) { - if (*id != vcpu->vcpu_id) - return -EINVAL; - } else { - if (set) - *id >>= 24; - else - *id <<= 24; - } + + if (!vcpu->kvm->arch.x2apic_format && set) + *id >>= 24; + + if (*id != vcpu->vcpu_id) + return -EINVAL; + + if (!vcpu->kvm->arch.x2apic_format && !set) + *id <<= 24; /* In x2APIC mode, the LDR is fixed and based on the id */ if (set) -- 2.26.3
Powered by blists - more mailing lists