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]
Date:   Mon, 26 Dec 2022 11:21:57 +0000
From:   David Woodhouse <dwmw2@...radead.org>
To:     Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Cc:     paul@....org, seanjc@...gle.com, Michal Luczaj <mhal@...x.co>
Subject: Re: [PATCH] KVM: x86/xen: Fix SRCU/RCU usage in readers of
 evtchn_ports

On Sat, 2022-12-24 at 03:53 -0500, Paolo Bonzini wrote:
> @@ -2005,19 +2009,23 @@ static bool kvm_xen_hcall_evtchn_send(struct kvm_vcpu *vcpu, u64 param, u64 *r)
>         gpa_t gpa;
>         int idx;
>  
> +       /*
> +        * evtchnfd is protected by kvm->srcu; the idr lookup instead
> +        * is protected by RCU.
> +        */
>         idx = srcu_read_lock(&vcpu->kvm->srcu);
>         gpa = kvm_mmu_gva_to_gpa_system(vcpu, param, NULL);
> -       srcu_read_unlock(&vcpu->kvm->srcu, idx);
>  
>         if (!gpa || kvm_vcpu_read_guest(vcpu, gpa, &send, sizeof(send))) {
>                 *r = -EFAULT;
> -               return true;
> +               goto out_handled;
>         }
>  
> -       /* The evtchn_ports idr is protected by vcpu->kvm->srcu */
> +       rcu_read_lock();
>         evtchnfd = idr_find(&vcpu->kvm->arch.xen.evtchn_ports, send.port);
> +       rcu_read_unlock();
>         if (!evtchnfd)
> -               return false;
> +               goto out_not_handled;
>  
>         if (evtchnfd->deliver.port.port) {
>                 int ret = kvm_xen_set_evtchn(&evtchnfd->deliver.port, vcpu->kvm);


You left a 'return false' in the failure path of this
kvm_xen_set_evtchn() call instead of changing it to 'goto
out_not_handled'.

So rather than adding my kvm_read_guest_virt() patch on top and
removing all the gotos, I'm going to put my patch first and put a
simpler version of your patch on top.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ