]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: selftests: Test MADV_COLLAPSE on guest_memfd
authorAckerley Tng <ackerleytng@google.com>
Fri, 20 Feb 2026 23:54:36 +0000 (23:54 +0000)
committerSean Christopherson <seanjc@google.com>
Wed, 4 Mar 2026 22:57:27 +0000 (14:57 -0800)
commit9830209b4ae8c8eecae7e6af271cebf1e1285142
tree5d23fe90b8c9230c0ceafd30513c7cdced5eb701
parent58f5d8eebd5c6b0c9377391d6b7bf9d321e014cc
KVM: selftests: Test MADV_COLLAPSE on guest_memfd

guest_memfd only supports PAGE_SIZE pages, and khugepaged or MADV_COLLAPSE
collapsing pages may result in private memory regions being mapped into
host page tables.

Add test to verify that MADV_COLLAPSE fails on guest_memfd folios, and any
subsequent usage of guest_memfd memory faults in PAGE_SIZE folios. Running
this test should not result in any memory failure logs or kernel WARNings.

This selftest was added as a result of a syzbot-reported issue where
khugepaged operating on guest_memfd memory with MADV_HUGEPAGE caused the
collapse of folios, which then subsequently resulted in a WARNing.

Link: https://syzkaller.appspot.com/bug?extid=33a04338019ac7e43a44
Suggested-by: David Hildenbrand <david@kernel.org>
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
Link: https://patch.msgid.link/8048d04f150326d1e2231318aa9f1b3fce3e2e2c.1771630983.git.ackerleytng@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/guest_memfd_test.c