Re: [PATCH] KVM: selftests: Include sys/mman.h *and* linux/mman.h, via kvm_syscalls.h
From: Sean Christopherson
Date: Mon May 18 2026 - 20:41:56 EST
On Mon, 27 Apr 2026 18:25:03 -0700, Sean Christopherson wrote:
> Include both linux/mman.h (the kernel provided version) and sys/mman.h (the
> libc provided version) throughout KVM selftests, by way of kvm_syscalls.h
> (which should have been including sys/mman.h anyways). Pulling in the
> kernel's version fixes compilation errors with the guest_memfd test on
> older versions of libc due to a recent commit adding MADV_COLLAPSE testing.
>
> In file included from include/kvm_util.h:8,
> from guest_memfd_test.c:21:
> guest_memfd_test.c: In function ‘test_collapse’:
> guest_memfd_test.c:219:47: error: ‘MADV_COLLAPSE’ undeclared (first use in this function); did you mean ‘MADV_COLD’?
> 219 | TEST_ASSERT_EQ(madvise(mem, pmd_size, MADV_COLLAPSE), -1);
> | ^~~~~~~~~~~~~
> include/test_util.h:62:16: note: in definition of macro ‘TEST_ASSERT_EQ’
> 62 | typeof(a) __a = (a); \
> | ^
> guest_memfd_test.c:219:47: note: each undeclared identifier is reported only once for each function it appears in
> 219 | TEST_ASSERT_EQ(madvise(mem, pmd_size, MADV_COLLAPSE), -1);
> | ^~~~~~~~~~~~~
> include/test_util.h:62:16: note: in definition of macro ‘TEST_ASSERT_EQ’
> 62 | typeof(a) __a = (a); \
> | ^
>
> [...]
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: selftests: Include sys/mman.h *and* linux/mman.h, via kvm_syscalls.h
https://github.com/kvm-x86/linux/commit/6d3790bc689d
--
https://github.com/kvm-x86/linux/tree/next