* Re: [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes on ucontrol VMs
@ 2024-12-18 15:06 Hariharan Mari
0 siblings, 0 replies; 3+ messages in thread
From: Hariharan Mari @ 2024-12-18 15:06 UTC (permalink / raw)
To: Christoph Schlameuss
Cc: kvm, Christian Borntraeger, Janosch Frank, Claudio Imbrenda,
David Hildenbrand, Paolo Bonzini, Shuah Khan, linux-s390,
linux-kselftest, Ulrich Weigand, Dominik Dingel, Cornelia Huck
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 0/6] selftests: kvm: s390: Reject invalid ioctls on ucontrol VMs
@ 2024-12-16 9:21 Christoph Schlameuss
2024-12-16 9:21 ` [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes " Christoph Schlameuss
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Schlameuss @ 2024-12-16 9:21 UTC (permalink / raw)
To: kvm
Cc: Christian Borntraeger, Janosch Frank, Claudio Imbrenda,
David Hildenbrand, Paolo Bonzini, Shuah Khan, linux-s390,
linux-kselftest, Ulrich Weigand, Dominik Dingel, Cornelia Huck
This patch series adds more test case issuing ioctls to ucontrol VMs and
its floating interrupt controller.
The test cases trigger three possible null pointer dereferences within
the handling of the KVM_DEV_FLIC_APF_ENABLE,
KVM_DEV_FLIC_APF_DISABLE_WAIT and KVM_SET_GSI_ROUTING ioctl.
All of these issues do only exist on ucontrol VMs. Fixes for the issues
are included within the patch series.
v2:
- added documentation changes
- simplify uc_flic_attrs; remove .getrc and .setrc from uc_flic_attrs
(Thanks Claudio)
Christoph Schlameuss (6):
kvm: s390: Reject setting flic pfault attributes on ucontrol VMs
selftests: kvm: s390: Add ucontrol flic attr selftests
kvm: s390: Reject KVM_SET_GSI_ROUTING on ucontrol VMs
selftests: kvm: s390: Add ucontrol gis routing test
selftests: kvm: s390: Streamline uc_skey test to issue iske after sske
selftests: kvm: s390: Add has device attr check to uc_attr_mem_limit
selftest
Documentation/virt/kvm/api.rst | 3 +
Documentation/virt/kvm/devices/s390_flic.rst | 4 +
arch/s390/kvm/interrupt.c | 6 +
.../selftests/kvm/s390x/ucontrol_test.c | 194 ++++++++++++++++--
4 files changed, 189 insertions(+), 18 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes on ucontrol VMs
2024-12-16 9:21 [PATCH v2 0/6] selftests: kvm: s390: Reject invalid ioctls " Christoph Schlameuss
@ 2024-12-16 9:21 ` Christoph Schlameuss
2024-12-19 10:03 ` Hariharan Mari
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Schlameuss @ 2024-12-16 9:21 UTC (permalink / raw)
To: kvm
Cc: Christian Borntraeger, Janosch Frank, Claudio Imbrenda,
David Hildenbrand, Paolo Bonzini, Shuah Khan, linux-s390,
linux-kselftest, Ulrich Weigand, Dominik Dingel, Cornelia Huck
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>
---
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
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes on ucontrol VMs
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
0 siblings, 0 replies; 3+ messages in thread
From: Hariharan Mari @ 2024-12-19 10:03 UTC (permalink / raw)
To: Christoph Schlameuss
Cc: kvm, Christian Borntraeger, Janosch Frank, Claudio Imbrenda,
David Hildenbrand, Paolo Bonzini, Shuah Khan, linux-s390,
linux-kselftest, Ulrich Weigand, Dominik Dingel, Cornelia Huck
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>
Reviewed-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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-19 10:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 15:06 [PATCH v2 1/6] kvm: s390: Reject setting flic pfault attributes on ucontrol VMs Hariharan Mari
-- strict thread matches above, loose matches on Subject: below --
2024-12-16 9:21 [PATCH v2 0/6] selftests: kvm: s390: Reject invalid ioctls " 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox