Thread (12 messages) 12 messages, 3 authors, 2025-11-13

Re: [PATCH v2 2/4] KVM: selftests: Fix unaligned mmap allocations

From: Sean Christopherson <seanjc@google.com>
Date: 2025-11-03 21:08:11
Also in: kvmarm, linux-kselftest, lkml

On Tue, Oct 28, 2025, Jack Thomson wrote:

On 23/10/2025 6:16 pm, Sean Christopherson wrote:
quoted
On Mon, Oct 13, 2025, Jack Thomson wrote:
quoted
From: Jack Thomson <redacted>

When creating a VM using mmap with huge pages, and the memory amount does
not align with the underlying page size. The stored mmap_size value does
not account for the fact that mmap will automatically align the length
to a multiple of the underlying page size. During the teardown of the
test, munmap is used. However, munmap requires the length to be a
multiple of the underlying page size.
What happens when selftests use the wrong map_size?  E.g. is munmap() silently
failing?  If so, then I should probably take this particular patch through
kvm-x86/gmem, otherwise it means we'll start getting asserts due to:

   3223560c93eb ("KVM: selftests: Define wrappers for common syscalls to assert success")

If munmap() isn't failing, then that begs the question of what this patch is
actually doing :-)
Hi Sean, sorry I completely missed your reply.

Yeah currently with a misaligned map_size it causes munmap() to fail, I
noticed when tested with different backings.
Exactly which tests fail?  I ask because I'm not sure we want to fix this by
having vm_mem_add() paper over test issues (I vaguely recall looking at this in
the past, but I can't find or recall the details).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help