[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] accel/kvm: add PIO ioeventfds only in case kvm_eventfds_allo
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH] accel/kvm: add PIO ioeventfds only in case kvm_eventfds_allowed is true |
Date: |
Mon, 19 Oct 2020 11:05:12 +0100 |
On Sat, Oct 17, 2020 at 02:01:01PM -0700, Elena Afanasova wrote:
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
> ---
> accel/kvm/kvm-all.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Additional information for the commit description:
MMIO eventfd_add/del are only registered when kvm_eventfds_allowed is
true but for PIO they are registered unconditionally. This is a bug
because kvm.ko ioeventfd should not be used if kvm_eventfds_allowed is
false.
This issue is a latent bug because ioeventfd is usually available when
KVM is enabled.
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 9ef5daf4c5..baaa54249d 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2239,8 +2239,10 @@ static int kvm_init(MachineState *ms)
>
> kvm_memory_listener_register(s, &s->memory_listener,
> &address_space_memory, 0);
> - memory_listener_register(&kvm_io_listener,
> - &address_space_io);
> + if (kvm_eventfds_allowed) {
> + memory_listener_register(&kvm_io_listener,
> + &address_space_io);
> + }
> memory_listener_register(&kvm_coalesced_pio_listener,
> &address_space_io);
>
> --
> 2.25.1
>
signature.asc
Description: PGP signature