Re: [PATCH v2 4/5] KVM: SNP: Fix kunmap_local() unmapping order
From: Sean Christopherson
Date: Tue May 26 2026 - 12:09:52 EST
Similar comment on the shortlog as patch two. "Fix the order" tells the reader
nothing useful, other than the author of the patch thought there was a bug.
KVM: SEV: Unmap local kmaps in LIFO order, per highmem requirements
No need for a new version, I'll massage when applying.
On Fri, May 22, 2026, Ackerley Tng wrote:
> Mappings created with kmap_local_page() or kmap_local_pfn() must be
> unmapped in the reverse order they were acquired, following a LIFO
> (last-in, first-out) stack-based approach.
>
> In sev_gmem_post_populate(), src_vaddr is mapped first and dst_vaddr is
> mapped second. The current code incorrectly calls kunmap_local() for
> src_vaddr before dst_vaddr.
>
> Swap the kunmap_local() calls to ensure the mappings are released in the
> correct order.
It's worth calling out that this is completely benign since SNP is 64-bit only.