Skip to content

Instantly share code, notes, and snippets.

@laurelmay
Created January 16, 2019 21:54
Show Gist options
  • Save laurelmay/a888b5b17f5762e5c8af3603834e272c to your computer and use it in GitHub Desktop.
Save laurelmay/a888b5b17f5762e5c8af3603834e272c to your computer and use it in GitHub Desktop.
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment