DONOTMERGE: KVM: selftests: Fix MADV_COLLAPSE build failure on older toolchains
An equivalent commit has been submitted and accepted into a fixes
branch upstream, but hasn't made it yet. Keep this until that happens,
otherwise the selftests won't build.
guest_memfd_test.c uses MADV_COLLAPSE unconditionally, but the
constant was only exposed in glibc 2.37. Distros still on older glibc
(e.g. Debian Bookworm, glibc 2.36) cannot build the test.
Add a compile-time fallback that defines MADV_COLLAPSE to its
kernel-ABI value when the libc header does not, matching the
established selftest pattern for sometimes-missing libc constants
(see selftests/bpf/uprobe_multi.c, selftests/mm/hugetlb-soft-offline.c).
Fixes: 9830209b4ae8 ("KVM: selftests: Test MADV_COLLAPSE on guest_memfd")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
1 file changed