* [GIT PULL 0/2] KVM: s390: Fixes for 6.8
@ 2024-01-22 16:22 Janosch Frank
2024-01-22 16:22 ` [GIT PULL 1/2] KVM: s390: vsie: fix race during shadow creation Janosch Frank
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Janosch Frank @ 2024-01-22 16:22 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda
Paolo,
please pull the fixes for the following two problems:
- The PQAP instruction did not set the CC in all occasions
- We observed crashes with nested guests because a pointer to struct
kvm was accessed before being valid (resulting in NULL pointers).
You'll see that the fixes are still based on 6.7-rc4 since they've
lived on our master for quite a while. But I've re-based them on
Linus' master and your queue and next branches without an issue.
The following changes since commit 4cdf351d3630a640ab6a05721ef055b9df62277f:
KVM: SVM: Update EFER software model on CR0 trap for SEV-ES (2023-12-08 13:37:05 -0500)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-master-6.8-1
for you to fetch changes up to 83303a4c776ce1032d88df59e811183479acea77:
KVM: s390: fix cc for successful PQAP (2024-01-08 18:05:44 +0100)
----------------------------------------------------------------
pqap instruction missing cc fix
vsie shadow creation race fix
----------------------------------------------------------------
Christian Borntraeger (1):
KVM: s390: vsie: fix race during shadow creation
Eric Farman (1):
KVM: s390: fix cc for successful PQAP
arch/s390/kvm/priv.c | 8 ++++++--
arch/s390/kvm/vsie.c | 1 -
arch/s390/mm/gmap.c | 1 +
3 files changed, 7 insertions(+), 3 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [GIT PULL 1/2] KVM: s390: vsie: fix race during shadow creation
2024-01-22 16:22 [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Janosch Frank
@ 2024-01-22 16:22 ` Janosch Frank
2024-01-22 16:22 ` [GIT PULL 2/2] KVM: s390: fix cc for successful PQAP Janosch Frank
2024-01-26 17:57 ` [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Janosch Frank @ 2024-01-22 16:22 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda
From: Christian Borntraeger <borntraeger@linux.ibm.com>
Right now it is possible to see gmap->private being zero in
kvm_s390_vsie_gmap_notifier resulting in a crash. This is due to the
fact that we add gmap->private == kvm after creation:
static int acquire_gmap_shadow(struct kvm_vcpu *vcpu,
struct vsie_page *vsie_page)
{
[...]
gmap = gmap_shadow(vcpu->arch.gmap, asce, edat);
if (IS_ERR(gmap))
return PTR_ERR(gmap);
gmap->private = vcpu->kvm;
Let children inherit the private field of the parent.
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Fixes: a3508fbe9dc6 ("KVM: s390: vsie: initial support for nested virtualization")
Cc: <stable@vger.kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20231220125317.4258-1-borntraeger@linux.ibm.com
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
arch/s390/kvm/vsie.c | 1 -
arch/s390/mm/gmap.c | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 8207a892bbe2..db9a180de65f 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -1220,7 +1220,6 @@ static int acquire_gmap_shadow(struct kvm_vcpu *vcpu,
gmap = gmap_shadow(vcpu->arch.gmap, asce, edat);
if (IS_ERR(gmap))
return PTR_ERR(gmap);
- gmap->private = vcpu->kvm;
vcpu->kvm->stat.gmap_shadow_create++;
WRITE_ONCE(vsie_page->gmap, gmap);
return 0;
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 6f96b5a71c63..8da39deb56ca 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -1691,6 +1691,7 @@ struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce,
return ERR_PTR(-ENOMEM);
new->mm = parent->mm;
new->parent = gmap_get(parent);
+ new->private = parent->private;
new->orig_asce = asce;
new->edat_level = edat_level;
new->initialized = false;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [GIT PULL 2/2] KVM: s390: fix cc for successful PQAP
2024-01-22 16:22 [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Janosch Frank
2024-01-22 16:22 ` [GIT PULL 1/2] KVM: s390: vsie: fix race during shadow creation Janosch Frank
@ 2024-01-22 16:22 ` Janosch Frank
2024-01-26 17:57 ` [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Janosch Frank @ 2024-01-22 16:22 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda
From: Eric Farman <farman@linux.ibm.com>
The various errors that are possible when processing a PQAP
instruction (the absence of a driver hook, an error FROM that
hook), all correctly set the PSW condition code to 3. But if
that processing works successfully, CC0 needs to be set to
convey that everything was fine.
Fix the check so that the guest can examine the condition code
to determine whether GPR1 has meaningful data.
Fixes: e5282de93105 ("s390: ap: kvm: add PQAP interception for AQIC")
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Link: https://lore.kernel.org/r/20231201181657.1614645-1-farman@linux.ibm.com
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20231201181657.1614645-1-farman@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
arch/s390/kvm/priv.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 621a17fd1a1b..f875a404a0a0 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -676,8 +676,12 @@ static int handle_pqap(struct kvm_vcpu *vcpu)
if (vcpu->kvm->arch.crypto.pqap_hook) {
pqap_hook = *vcpu->kvm->arch.crypto.pqap_hook;
ret = pqap_hook(vcpu);
- if (!ret && vcpu->run->s.regs.gprs[1] & 0x00ff0000)
- kvm_s390_set_psw_cc(vcpu, 3);
+ if (!ret) {
+ if (vcpu->run->s.regs.gprs[1] & 0x00ff0000)
+ kvm_s390_set_psw_cc(vcpu, 3);
+ else
+ kvm_s390_set_psw_cc(vcpu, 0);
+ }
up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [GIT PULL 0/2] KVM: s390: Fixes for 6.8
2024-01-22 16:22 [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Janosch Frank
2024-01-22 16:22 ` [GIT PULL 1/2] KVM: s390: vsie: fix race during shadow creation Janosch Frank
2024-01-22 16:22 ` [GIT PULL 2/2] KVM: s390: fix cc for successful PQAP Janosch Frank
@ 2024-01-26 17:57 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2024-01-26 17:57 UTC (permalink / raw)
To: Janosch Frank; +Cc: kvm, david, borntraeger, cohuck, linux-s390, imbrenda
On Mon, Jan 22, 2024 at 5:25 PM Janosch Frank <frankja@linux.ibm.com> wrote:
>
> Paolo,
>
> please pull the fixes for the following two problems:
> - The PQAP instruction did not set the CC in all occasions
> - We observed crashes with nested guests because a pointer to struct
> kvm was accessed before being valid (resulting in NULL pointers).
>
> You'll see that the fixes are still based on 6.7-rc4 since they've
> lived on our master for quite a while. But I've re-based them on
> Linus' master and your queue and next branches without an issue.
>
> The following changes since commit 4cdf351d3630a640ab6a05721ef055b9df62277f:
>
> KVM: SVM: Update EFER software model on CR0 trap for SEV-ES (2023-12-08 13:37:05 -0500)
>
> are available in the Git repository at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-master-6.8-1
>
> for you to fetch changes up to 83303a4c776ce1032d88df59e811183479acea77:
>
> KVM: s390: fix cc for successful PQAP (2024-01-08 18:05:44 +0100)
Pulled, thanks.
Paolo
> ----------------------------------------------------------------
> pqap instruction missing cc fix
> vsie shadow creation race fix
> ----------------------------------------------------------------
>
> Christian Borntraeger (1):
> KVM: s390: vsie: fix race during shadow creation
>
> Eric Farman (1):
> KVM: s390: fix cc for successful PQAP
>
> arch/s390/kvm/priv.c | 8 ++++++--
> arch/s390/kvm/vsie.c | 1 -
> arch/s390/mm/gmap.c | 1 +
> 3 files changed, 7 insertions(+), 3 deletions(-)
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-26 17:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 16:22 [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Janosch Frank
2024-01-22 16:22 ` [GIT PULL 1/2] KVM: s390: vsie: fix race during shadow creation Janosch Frank
2024-01-22 16:22 ` [GIT PULL 2/2] KVM: s390: fix cc for successful PQAP Janosch Frank
2024-01-26 17:57 ` [GIT PULL 0/2] KVM: s390: Fixes for 6.8 Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox