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: <DM6PR12MB3500F2EB5DA46DEE00CCFCE4CAAC9@DM6PR12MB3500.namprd12.prod.outlook.com>
Date:   Thu, 16 Jun 2022 03:04:46 +0000
From:   Kechen Lu <kechenl@...dia.com>
To:     Chao Gao <chao.gao@...el.com>
CC:     "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "seanjc@...gle.com" <seanjc@...gle.com>,
        "vkuznets@...hat.com" <vkuznets@...hat.com>,
        Somdutta Roy <somduttar@...dia.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH v3 5/7] KVM: x86: add vCPU scoped toggling for
 disabled exits



> -----Original Message-----
> From: Chao Gao <chao.gao@...el.com>
> Sent: Tuesday, June 14, 2022 7:43 PM
> To: Kechen Lu <kechenl@...dia.com>
> Cc: kvm@...r.kernel.org; pbonzini@...hat.com; seanjc@...gle.com;
> vkuznets@...hat.com; Somdutta Roy <somduttar@...dia.com>; linux-
> kernel@...r.kernel.org
> Subject: Re: [RFC PATCH v3 5/7] KVM: x86: add vCPU scoped toggling for
> disabled exits
> 
> External email: Use caution opening links or attachments
> 
> 
> >@@ -5980,6 +5987,8 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct
> >kvm_irq_level *irq_event,  int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
> >                           struct kvm_enable_cap *cap)  {
> >+      struct kvm_vcpu *vcpu;
> >+      unsigned long i;
> >       int r;
> >
> >       if (cap->flags)
> >@@ -6036,14 +6045,17 @@ int kvm_vm_ioctl_enable_cap(struct kvm
> *kvm,
> >                       break;
> >
> >               mutex_lock(&kvm->lock);
> >-              if (kvm->created_vcpus)
> >-                      goto disable_exits_unlock;
> >+              if (kvm->created_vcpus) {
> >+                      kvm_for_each_vcpu(i, vcpu, kvm) {
> >+                              kvm_ioctl_disable_exits(vcpu->arch, cap->args[0]);
> >+
> >+ static_call(kvm_x86_update_disabled_exits)(vcpu);
> 
> IMO, this won't work on Intel platforms. Because, to manipulate a vCPU's
> VMCS, vcpu_load() should be invoked in advance to load the VMCS.
> Alternatively, you can add a request KVM_REQ_XXX and defer updating
> VMCS to the next vCPU entry.
> 

I see. Then adding a KVM request for VM-scoped exits toggling case on vmcs bits updating makes sense. 
Thanks for the suggestion.

BR,
Kechen
> >+                      }
> >+              }
> >+              mutex_unlock(&kvm->lock);
> >
> >               kvm_ioctl_disable_exits(kvm->arch, cap->args[0]);
> >
> >               r = 0;
> >-disable_exits_unlock:
> >-              mutex_unlock(&kvm->lock);
> >               break;
> >       case KVM_CAP_MSR_PLATFORM_INFO:
> >               kvm->arch.guest_can_read_msr_platform_info =
> >cap->args[0];
> >--
> >2.32.0
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ