[vbox-dev] [PATCH] Fix compilation of host modules on Linux kernel 5.0
Kyle Laker
kyle at laker.email
Wed Jan 16 22:11:25 UTC 2019
The API for the access_ok() macro has changed in 5.0 to remove the first
argument. Which means the host modules do not compile on the 5.0 kernel.
I was able to resolve it with the following patch. I did not find any
other instances where access_ok() is used.
I have not signed the CA; however, this code is contributed under the
terms of the MIT License.
- Kyle
Index: src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
===================================================================
--- src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c (revision
76826)
+++ src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c (working copy)
@@ -66,7 +66,11 @@
RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)
{
IPRT_LINUX_SAVE_EFL_AC();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
+ bool fRc = access_ok((void *)R3Ptr, 1);
+#else
bool fRc = access_ok(VERIFY_READ, (void *)R3Ptr, 1);
+#endif
IPRT_LINUX_RESTORE_EFL_AC();
return fRc;
}
@@ -82,7 +86,11 @@
return (uintptr_t)pv >= PAGE_OFFSET;
#else
# error "PORT ME"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
+ return !access_ok(pv, 1);
+#else
return !access_ok(VERIFY_READ, pv, 1);
+#endif /* LINUX_VERSION_CODE */
#endif
}
RT_EXPORT_SYMBOL(RTR0MemKernelIsValidAddr);
More information about the vbox-dev
mailing list