[v1,1/2] KVM: s390: vsie: fix < 8k check for the itdba
diff mbox

Message ID 20180502110814.31971-1-david@redhat.com
State New
Headers show

Commit Message

David Hildenbrand May 2, 2018, 11:08 a.m. UTC
By missing an "L", we might detect some addresses to be <8k,
although they are not.

e.g. for itdba = 100001fff
!(gpa & ~0x1fffU) -> 1
!(gpa & ~0x1fffUL) -> 0

So we would report a SIE validity intercept although everything is fine.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/kvm/vsie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Borntraeger May 2, 2018, 12:34 p.m. UTC | #1
On 05/02/2018 01:08 PM, David Hildenbrand wrote:
> By missing an "L", we might detect some addresses to be <8k,
> although they are not.
> 
> e.g. for itdba = 100001fff
> !(gpa & ~0x1fffU) -> 1
> !(gpa & ~0x1fffUL) -> 0
> 
> So we would report a SIE validity intercept although everything is fine.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>

Should be cc stable as is might break vsie if for some reason the block is
aligned by 4G.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

> ---
>  arch/s390/kvm/vsie.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 8961e3970901..969882b54266 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -578,7 +578,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  
>  	gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
>  	if (gpa && (scb_s->ecb & ECB_TE)) {
> -		if (!(gpa & ~0x1fffU)) {
> +		if (!(gpa & ~0x1fffUL)) {
>  			rc = set_validity_icpt(scb_s, 0x0080U);
>  			goto unpin;
>  		}
>
David Hildenbrand May 2, 2018, 2:30 p.m. UTC | #2
On 02.05.2018 14:34, Christian Borntraeger wrote:
> 
> 
> On 05/02/2018 01:08 PM, David Hildenbrand wrote:
>> By missing an "L", we might detect some addresses to be <8k,
>> although they are not.
>>
>> e.g. for itdba = 100001fff
>> !(gpa & ~0x1fffU) -> 1
>> !(gpa & ~0x1fffUL) -> 0
>>
>> So we would report a SIE validity intercept although everything is fine.
>>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
> 
> Should be cc stable as is might break vsie if for some reason the block is
> aligned by 4G.

The only known user is KVM itself. As it has an offset in the sie_page,
this scenario can at least never happen with KVMs we know.

So I'll leave this decision to you. Thanks!

> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

Patch
diff mbox

diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 8961e3970901..969882b54266 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -578,7 +578,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 
 	gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
 	if (gpa && (scb_s->ecb & ECB_TE)) {
-		if (!(gpa & ~0x1fffU)) {
+		if (!(gpa & ~0x1fffUL)) {
 			rc = set_validity_icpt(scb_s, 0x0080U);
 			goto unpin;
 		}