All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hariharan Mari <hari55@linux.ibm.com>
To: Christoph Schlameuss <schlameuss@linux.ibm.com>
Cc: kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Ulrich Weigand <ulrich.weigand@de.ibm.com>,
	Dominik Dingel <dingel@linux.vnet.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>
Subject: Re: [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes on ucontrol VMs
Date: Wed, 18 Dec 2024 16:06:33 +0100	[thread overview]
Message-ID: <ea0ee2ae6432e8789a00955a5c1537aa@linux.ibm.com> (raw)

On 2024-12-16 10:21, Christoph Schlameuss wrote:
> Prevent null pointer dereference when processing the
> KVM_DEV_FLIC_APF_ENABLE and KVM_DEV_FLIC_APF_DISABLE_WAIT ioctls in the
> interrupt controller.
> 
> Fixes: 3c038e6be0e2 ("KVM: async_pf: Async page fault support on s390")
> Reported-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>

Tested-by: Hariharan Mari <hari55@linux.ibm.com>
> ---
>  Documentation/virt/kvm/devices/s390_flic.rst | 4 ++++
>  arch/s390/kvm/interrupt.c                    | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/Documentation/virt/kvm/devices/s390_flic.rst
> b/Documentation/virt/kvm/devices/s390_flic.rst
> index ea96559ba501..b784f8016748 100644
> --- a/Documentation/virt/kvm/devices/s390_flic.rst
> +++ b/Documentation/virt/kvm/devices/s390_flic.rst
> @@ -58,11 +58,15 @@ Groups:
>      Enables async page faults for the guest. So in case of a major 
> page fault
>      the host is allowed to handle this async and continues the guest.
> 
> +    -EINVAL is returned when called on the FLIC of a ucontrol VM.
> +
>    KVM_DEV_FLIC_APF_DISABLE_WAIT
>      Disables async page faults for the guest and waits until already 
> pending
>      async page faults are done. This is necessary to trigger a
> completion interrupt
>      for every init interrupt before migrating the interrupt list.
> 
> +    -EINVAL is returned when called on the FLIC of a ucontrol VM.
> +
>    KVM_DEV_FLIC_ADAPTER_REGISTER
>      Register an I/O adapter interrupt source. Takes a 
> kvm_s390_io_adapter
>      describing the adapter to register::
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index ea8dce299954..22d73c13e555 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -2678,9 +2678,13 @@ static int flic_set_attr(struct kvm_device
> *dev, struct kvm_device_attr *attr)
>  		kvm_s390_clear_float_irqs(dev->kvm);
>  		break;
>  	case KVM_DEV_FLIC_APF_ENABLE:
> +		if (kvm_is_ucontrol(dev->kvm))
> +			return -EINVAL;
>  		dev->kvm->arch.gmap->pfault_enabled = 1;
>  		break;
>  	case KVM_DEV_FLIC_APF_DISABLE_WAIT:
> +		if (kvm_is_ucontrol(dev->kvm))
> +			return -EINVAL;
>  		dev->kvm->arch.gmap->pfault_enabled = 0;
>  		/*
>  		 * Make sure no async faults are in transition when

             reply	other threads:[~2024-12-18 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 15:06 Hariharan Mari [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-16  9:21 [PATCH v2 0/6] selftests: kvm: s390: Reject invalid ioctls on ucontrol VMs Christoph Schlameuss
2024-12-16  9:21 ` [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes " Christoph Schlameuss
2024-12-19 10:03   ` Hariharan Mari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea0ee2ae6432e8789a00955a5c1537aa@linux.ibm.com \
    --to=hari55@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=dingel@linux.vnet.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=schlameuss@linux.ibm.com \
    --cc=shuah@kernel.org \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.