Re: [PATCH v2 1/5] KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks

From: David Hildenbrand
Date: Fri Apr 03 2020 - 15:55:08 EST




> Am 03.04.2020 um 19:56 schrieb Christian Borntraeger <borntraeger@xxxxxxxxxx>:
>
> ï
>
>> On 03.04.20 17:30, David Hildenbrand wrote:
>> In case we have a region 1 ASCE, our shadow/g3 address can have any value.
>> Unfortunately, (-1UL << 64) is undefined and triggers sometimes,
>> rejecting valid shadow addresses when trying to walk our shadow table
>> hierarchy.
>
> I thin the range of the addresses do not matter.
> Took me a while to understand maybe rephrase that:
>
> In case we have a region 1 the following calculation
> (31 + ((gmap->asce & _ASCE_TYPE_MASK) >> 2)*11)
> results in 64. As shifts beyond the size are undefined the compiler is free to use
> instructions like sllg. sllg will only use 6 bits of the shift value (here 64)
> resulting in no shift at all. That means that ALL addresses will be rejected.

Interestingly, it would not fail when shadowing the r2t, but only when trying to shadow the r3t.

>
> With that this makes sense.
>
> Reviewed-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
>

In case there are no other comments, can you fixup when applying, or do you want me to resend?

Cheers