Re: [PATCH] KVM: s390: fix validity interception issue when gisa is switched off

Michael Mueller
2024-08-01T12:27:53Z

On 31.07.24 14:05, Janosch Frank wrote:
> On 7/31/24 1:31 PM, Michael Mueller wrote:
>> The following validity interception occures when the gisa usage has been
>> switched off either by using kernel parameter "kvm.use_gisa=0" or by
>> setting the related sysfs attribute to N (echo N >/sys/module/kvm/
>> parameters/use_gisa).
>>
>> The issue surfaces in the host kernel with the following kernel
>> message as
>> soon a new kvm guest start has been attemted.
>
> How about:
>
> We might run into a SIE validity if gisa has been disabled either via
> using kernel parameter "kvm.use_gisa=0" or by setting the related sysfs
> attribute to N (echo N >/sys/module/kvm/parameters/use_gisa).
>
> The validity is caused by an invalid value in the SIE control block's
> gisa designation. That happens because we pass the uninitialized gisa
> origin to virt_to_phys() before writing it to the gisa designation.
>
> To fix this we return 0 in kvm_s390_get_gisa_desc() if the origin is 0.
> kvm_s390_get_gisa_desc() is used to determine which gisa designation to
> set in the SIE control block. A value of 0 in the gisa designation
> disables gisa usage.

Yep, used that version above now.
>
>
>> Cc: stable@vger.kernel.org
>> Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
>
>> Closes:
>> https://ibm-systems-z.slack.com/archives/C04BWBXSKEY/p1722280755665409
>
> I'd just remove that since it's not accessible for people outside of
> IBM. Yes, checkpatch will complain but in this case it's ok to ignore that.
>

dropped that line.

I will send v2 rigt away.

>> Fixes: fe0ef0030463 ("KVM: s390: sort out physical vs virtual pointers
>> usage")
>> Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
>> ---
>>   arch/s390/kvm/kvm-s390.h | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
>> index bf8534218af3..e680c6bf0c9d 100644
>> --- a/arch/s390/kvm/kvm-s390.h
>> +++ b/arch/s390/kvm/kvm-s390.h
>> @@ -267,7 +267,12 @@ static inline unsigned long
>> kvm_s390_get_gfn_end(struct kvm_memslots *slots)
>>   static inline u32 kvm_s390_get_gisa_desc(struct kvm *kvm)
>>   {
>> -    u32 gd = virt_to_phys(kvm->arch.gisa_int.origin);
>> +    u32 gd;
>> +
>> +    if (!kvm->arch.gisa_int.origin)
>> +        return 0;
>> +
>> +    gd = virt_to_phys(kvm->arch.gisa_int.origin);
>>       if (gd && sclp.has_gisaf)
>>           gd |= GISA_FORMAT1;
>
>