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: <515E8435.9090701@redhat.com>
Date:	Fri, 05 Apr 2013 09:58:45 +0200
From:	Paolo Bonzini <pbonzini@...hat.com>
To:	"Michael S. Tsirkin" <mst@...hat.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	Gleb Natapov <gleb@...hat.com>,
	Alex Williamson <alex.williamson@...hat.com>,
	Sasha Levin <sasha.levin@...cle.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kvm: fix MMIO/PIO collision misdetection

Il 04/04/2013 12:27, Michael S. Tsirkin ha scritto:
> PIO and MMIO are separate address spaces, but
> ioeventfd registration code mistakenly detected
> two eventfds as duplicate if they use the same address,
> even if one is PIO and another one MMIO.
> 
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>

Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>

> ---
>  virt/kvm/eventfd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index adb17f2..93e5b05 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -577,6 +577,7 @@ struct _ioeventfd {
>  	struct eventfd_ctx  *eventfd;
>  	u64                  datamatch;
>  	struct kvm_io_device dev;
> +	u8                   bus_idx;
>  	bool                 wildcard;
>  };
>  
> @@ -669,7 +670,8 @@ ioeventfd_check_collision(struct kvm *kvm, struct _ioeventfd *p)
>  	struct _ioeventfd *_p;
>  
>  	list_for_each_entry(_p, &kvm->ioeventfds, list)
> -		if (_p->addr == p->addr && _p->length == p->length &&
> +		if (_p->bus_idx == p->bus_idx &&
> +		    _p->addr == p->addr && _p->length == p->length &&
>  		    (_p->wildcard || p->wildcard ||
>  		     _p->datamatch == p->datamatch))
>  			return true;
> @@ -717,6 +719,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
>  
>  	INIT_LIST_HEAD(&p->list);
>  	p->addr    = args->addr;
> +	p->bus_idx = bus_idx;
>  	p->length  = args->len;
>  	p->eventfd = eventfd;
>  
> @@ -775,7 +778,8 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
>  	list_for_each_entry_safe(p, tmp, &kvm->ioeventfds, list) {
>  		bool wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
>  
> -		if (p->eventfd != eventfd  ||
> +		if (p->bus_idx != bus_idx ||
> +		    p->eventfd != eventfd  ||
>  		    p->addr != args->addr  ||
>  		    p->length != args->len ||
>  		    p->wildcard != wildcard)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ