* [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
@ 2019-04-26 8:56 Pierre Morel
2019-04-26 9:04 ` David Hildenbrand
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Pierre Morel @ 2019-04-26 8:56 UTC (permalink / raw)
To: david
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
borntraeger, schwidefsky, heiko.carstens
When the guest do not have AP instructions nor Key management
we should return without shadowing the CRYCB.
We did not check correctly in the past.
Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
validity")
Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/kvm/vsie.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index c6983d9..ac411e9 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
u8 ecb3_flags;
u32 ecd_flags;
int apie_h;
+ int apie_s;
int key_msk = test_kvm_facility(vcpu->kvm, 76);
int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
@@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
scb_s->crycbd = 0;
apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
- if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
+ apie_s = apie_h & scb_o->eca;
+ if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
return 0;
if (!crycb_addr)
@@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
((crycb_addr + 128) & PAGE_MASK))
return set_validity_icpt(scb_s, 0x003CU);
- if (apie_h && (scb_o->eca & ECA_APIE)) {
+ if (apie_s) {
ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
vcpu->kvm->arch.crypto.crycb,
fmt_o, fmt_h);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
2019-04-26 8:56 [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys Pierre Morel
@ 2019-04-26 9:04 ` David Hildenbrand
2019-04-26 10:59 ` Pierre Morel
2019-04-26 9:08 ` Christian Borntraeger
2019-04-29 7:10 ` Christian Borntraeger
2 siblings, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2019-04-26 9:04 UTC (permalink / raw)
To: Pierre Morel
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
borntraeger, schwidefsky, heiko.carstens
On 26.04.19 10:56, Pierre Morel wrote:
> When the guest do not have AP instructions nor Key management
> we should return without shadowing the CRYCB.
>
> We did not check correctly in the past.
>
> Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
> validity")
We should really try to pay more attention, commit b10bd9a256ae already
was supposed to fix 6ee74098201b.
Unfortunately, I don't have access to documentation and can't verify.
Acked-by: David Hildenbrand <david@redhat.com>
> Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/kvm/vsie.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index c6983d9..ac411e9 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> u8 ecb3_flags;
> u32 ecd_flags;
> int apie_h;
> + int apie_s;
> int key_msk = test_kvm_facility(vcpu->kvm, 76);
> int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
> int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
> @@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> scb_s->crycbd = 0;
>
> apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
> - if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
> + apie_s = apie_h & scb_o->eca;
> + if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
> return 0;
>
> if (!crycb_addr)
> @@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> ((crycb_addr + 128) & PAGE_MASK))
> return set_validity_icpt(scb_s, 0x003CU);
>
> - if (apie_h && (scb_o->eca & ECA_APIE)) {
> + if (apie_s) {
> ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
> vcpu->kvm->arch.crypto.crycb,
> fmt_o, fmt_h);
>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
2019-04-26 8:56 [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys Pierre Morel
2019-04-26 9:04 ` David Hildenbrand
@ 2019-04-26 9:08 ` Christian Borntraeger
2019-04-26 11:01 ` Pierre Morel
2019-04-29 7:10 ` Christian Borntraeger
2 siblings, 1 reply; 6+ messages in thread
From: Christian Borntraeger @ 2019-04-26 9:08 UTC (permalink / raw)
To: Pierre Morel, david
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
schwidefsky, heiko.carstens
On 26.04.19 10:56, Pierre Morel wrote:
> When the guest do not have AP instructions nor Key management
> we should return without shadowing the CRYCB.
>
> We did not check correctly in the past.
>
> Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
> validity")
> Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/kvm/vsie.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index c6983d9..ac411e9 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> u8 ecb3_flags;
> u32 ecd_flags;
> int apie_h;
> + int apie_s;
> int key_msk = test_kvm_facility(vcpu->kvm, 76);
> int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
> int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
> @@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> scb_s->crycbd = 0;
>
> apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
> - if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
> + apie_s = apie_h & scb_o->eca;
> + if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
> return 0;
>
> if (!crycb_addr)
> @@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> ((crycb_addr + 128) & PAGE_MASK))
> return set_validity_icpt(scb_s, 0x003CU);
>
> - if (apie_h && (scb_o->eca & ECA_APIE)) {
> + if (apie_s) {
> ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
> vcpu->kvm->arch.crypto.crycb,
> fmt_o, fmt_h);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
2019-04-26 9:04 ` David Hildenbrand
@ 2019-04-26 10:59 ` Pierre Morel
0 siblings, 0 replies; 6+ messages in thread
From: Pierre Morel @ 2019-04-26 10:59 UTC (permalink / raw)
To: David Hildenbrand
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
borntraeger, schwidefsky, heiko.carstens
On 26/04/2019 11:04, David Hildenbrand wrote:
> On 26.04.19 10:56, Pierre Morel wrote:
>> When the guest do not have AP instructions nor Key management
>> we should return without shadowing the CRYCB.
>>
>> We did not check correctly in the past.
>>
>> Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
>> validity")
>
> We should really try to pay more attention, commit b10bd9a256ae already
> was supposed to fix 6ee74098201b.
yes, sorry for that.
>
> Unfortunately, I don't have access to documentation and can't verify.
>
> Acked-by: David Hildenbrand <david@redhat.com>
Thanks
>
>> Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>> arch/s390/kvm/vsie.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
>> index c6983d9..ac411e9 100644
>> --- a/arch/s390/kvm/vsie.c
>> +++ b/arch/s390/kvm/vsie.c
>> @@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> u8 ecb3_flags;
>> u32 ecd_flags;
>> int apie_h;
>> + int apie_s;
>> int key_msk = test_kvm_facility(vcpu->kvm, 76);
>> int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
>> int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
>> @@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> scb_s->crycbd = 0;
>>
>> apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
>> - if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
>> + apie_s = apie_h & scb_o->eca;
>> + if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
>> return 0;
>>
>> if (!crycb_addr)
>> @@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> ((crycb_addr + 128) & PAGE_MASK))
>> return set_validity_icpt(scb_s, 0x003CU);
>>
>> - if (apie_h && (scb_o->eca & ECA_APIE)) {
>> + if (apie_s) {
>> ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
>> vcpu->kvm->arch.crypto.crycb,
>> fmt_o, fmt_h);
>>
>
>
--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
2019-04-26 9:08 ` Christian Borntraeger
@ 2019-04-26 11:01 ` Pierre Morel
0 siblings, 0 replies; 6+ messages in thread
From: Pierre Morel @ 2019-04-26 11:01 UTC (permalink / raw)
To: Christian Borntraeger, david
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
schwidefsky, heiko.carstens
On 26/04/2019 11:08, Christian Borntraeger wrote:
>
>
> On 26.04.19 10:56, Pierre Morel wrote:
>> When the guest do not have AP instructions nor Key management
>> we should return without shadowing the CRYCB.
>>
>> We did not check correctly in the past.
>>
>> Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
>> validity")
>> Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Thanks,
It gives a better feeling on this patch.
Pierre
>
>> ---
>> arch/s390/kvm/vsie.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
>> index c6983d9..ac411e9 100644
>> --- a/arch/s390/kvm/vsie.c
>> +++ b/arch/s390/kvm/vsie.c
>> @@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> u8 ecb3_flags;
>> u32 ecd_flags;
>> int apie_h;
>> + int apie_s;
>> int key_msk = test_kvm_facility(vcpu->kvm, 76);
>> int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
>> int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
>> @@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> scb_s->crycbd = 0;
>>
>> apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
>> - if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
>> + apie_s = apie_h & scb_o->eca;
>> + if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
>> return 0;
>>
>> if (!crycb_addr)
>> @@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>> ((crycb_addr + 128) & PAGE_MASK))
>> return set_validity_icpt(scb_s, 0x003CU);
>>
>> - if (apie_h && (scb_o->eca & ECA_APIE)) {
>> + if (apie_s) {
>> ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
>> vcpu->kvm->arch.crypto.crycb,
>> fmt_o, fmt_h);
>>
--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys
2019-04-26 8:56 [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys Pierre Morel
2019-04-26 9:04 ` David Hildenbrand
2019-04-26 9:08 ` Christian Borntraeger
@ 2019-04-29 7:10 ` Christian Borntraeger
2 siblings, 0 replies; 6+ messages in thread
From: Christian Borntraeger @ 2019-04-29 7:10 UTC (permalink / raw)
To: Pierre Morel, david
Cc: linux-kernel, cohuck, linux-s390, kvm, frankja, akrowiak,
schwidefsky, heiko.carstens
On 26.04.19 10:56, Pierre Morel wrote:
> When the guest do not have AP instructions nor Key management
> we should return without shadowing the CRYCB.
>
> We did not check correctly in the past.
>
> Fixes: b10bd9a256ae ("s390: vsie: Use effective CRYCBD.31 to check CRYCBD
> validity")
> Fixes: 6ee74098201b ("KVM: s390: vsie: allow CRYCB FORMAT-0")
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/kvm/vsie.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index c6983d9..ac411e9 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -290,6 +290,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> u8 ecb3_flags;
> u32 ecd_flags;
> int apie_h;
> + int apie_s;
> int key_msk = test_kvm_facility(vcpu->kvm, 76);
> int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
> int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
> @@ -298,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> scb_s->crycbd = 0;
>
> apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
> - if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
> + apie_s = apie_h & scb_o->eca;
> + if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
> return 0;
>
> if (!crycb_addr)
> @@ -309,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> ((crycb_addr + 128) & PAGE_MASK))
> return set_validity_icpt(scb_s, 0x003CU);
>
> - if (apie_h && (scb_o->eca & ECA_APIE)) {
> + if (apie_s) {
> ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
> vcpu->kvm->arch.crypto.crycb,
> fmt_o, fmt_h);
>
thanks applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-29 7:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-26 8:56 [PATCH] KVM: s390: vsie: Do not shadow CRYCB when no AP and no keys Pierre Morel
2019-04-26 9:04 ` David Hildenbrand
2019-04-26 10:59 ` Pierre Morel
2019-04-26 9:08 ` Christian Borntraeger
2019-04-26 11:01 ` Pierre Morel
2019-04-29 7:10 ` Christian Borntraeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox