Re: [PATCH] KVM: x86/mmu: x86: Don't overflow lpage_info when checking attributes

From: Edgecombe, Rick P
Date: Wed Mar 13 2024 - 12:26:10 EST


On Wed, 2024-03-13 at 02:49 -0700, Dongli Zhang wrote:
> The memslot id=10 has:
> - base_gfn=1048576
> - npages=1024
>
> Therefore, "level - 1  will not contain an entry for each GFN at page
> size
> level". If aligned, we expect lpage_info[0] to have 512 elements.
>
> 1GB: lpage_info[1] has 1 element
> 2MB: lpage_info[0] has 2 elemtnts

1048576 GFN is 2MB aligned, 1024 pages is also 2MB aligned. There are
512 4k pages in a 2MB huge page, so size of 2 for npages=1024 looks
right to me. One struct for each potential 2MB huge page in the range.

I think overall you are saying in this response that you didn't find
any problem in the analysis or fix. Is that correct?