Re: [PATCH v1 3/3] KVM: s390: generalize kvm_s390_get_tod_clock_ext()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02.05.2018 21:36, Christian Borntraeger wrote:
> 
> 
> On 04/27/2018 02:36 PM, David Hildenbrand wrote:
>> Move the Multiple-epoch facility handling into it and rename it to
> [..]
> 
> 
>> @@ -1055,13 +1057,7 @@ static int kvm_s390_get_tod_ext(struct kvm *kvm, struct kvm_device_attr *attr)
>>  {
>>  	struct kvm_s390_vm_tod_clock gtod;
>>  
>> -	memset(&gtod, 0, sizeof(gtod));
> 
> We should keep the memset, otherwise the padding might leak kernel info as we copy .
> (found by smatch)

Thanks for the info and running the checker.

@Janosch please tell me if I should resend!

> 
> 
>     arch/s390/kvm/kvm-s390.c:1068 kvm_s390_get_tod_ext() warn: check that 'gtod' doesn't leak information (struct has a hole after 'epoch_idx')
> 
> 
>> -
>> -	if (test_kvm_facility(kvm, 139))
>> -		kvm_s390_get_tod_clock_ext(kvm, &gtod);
>> -	else
>> -		gtod.tod = kvm_s390_get_tod_clock_fast(kvm);
>> -
>> +	kvm_s390_get_tod_clock(kvm, &gtod);
>>  	if (copy_to_user((void __user *)attr->addr, &gtod, sizeof(gtod)))
>>  		return -EFAULT;
>>  
>>
> 


-- 

Thanks,

David / dhildenb



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux