Messages in this thread | | | Date | Wed, 08 Mar 2023 01:59:46 +0000 | Subject | Re: [V2 PATCH 0/6] KVM: selftests: selftests for fd-based private memory | From | Ackerley Tng <> |
| |
Chao Peng <chao.p.peng@linux.intel.com> writes:
>> [...]
>> Chao, I'll work on
>> + Running conversion tests for non-overlapping GPA ranges of >> same/different memslots from multiple vcpus >> + Deleting memslots with restricted memfd while guests are being >> executed >> + Installing multiple memslots with ranges within the same restricted >> mem files
>> this week.
> Thanks Ackerley. Looks good to me.
> BTW, for whom may have interest, below are the testcases I added: > https://github.com/chao-p/linux/commit/24dd1257d5c93acb8c8cc6c76c51cf6869970f8a > https://github.com/chao-p/linux/commit/39a872ef09d539ce0c953451152eb05276b87018 > https://github.com/chao-p/linux/commit/ddd2c92b268a2fdc6158f82a6169ad1a57f2a01d
> Chao
Hi Chao,
While I was working on the selftests I noticed that this could perhaps be improved:
https://github.com/chao-p/linux/blob/ddd2c92b268a2fdc6158f82a6169ad1a57f2a01d/virt/kvm/kvm_main.c#L1035
We should use a temporary variable to hold the result of fget(fd).
As it is now, if the user provides any invalide fd, like -1, slot->restrictedmem.file would be overwritten and lost.
We cannot update slot->restrictedmem.file until after the file_is_restrictedmem() check.
For now there isn't a big problem because kvm_restrictedmem_bind() is only called on a new struct kvm_memory_slot, but I think this should be changed in case the function is used elsewhere in future.
Ackerley
| |