Quick patch for OpenSUSE Leap 42.3 using get_user_pages() API from kernel 4.10 on kernel 4.4 (sigh):
--- src/vboxguest-5.1.26/vboxguest/r0drv/linux/memobj-r0drv-linux.c.orig 2017-07-27 13:45:39.000000000 +0200
+++ src/vboxguest-5.1.26/vboxguest/r0drv/linux/memobj-r0drv-linux.c 2017-07-28 00:07:05.225700000 +0200
@@ -1101,18 +1101,14 @@
# endif
);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
- rc = get_user_pages(pTask, /* Task for fault accounting. */
- pTask->mm, /* Whose pages. */
- R3Ptr, /* Where from. */
+ /* The following is modified for Leap 42.3 having the
+ * get_user_pages() API from kernel 4.10
+ */
+ rc = get_user_pages(R3Ptr, /* Where from. */
cPages, /* How many pages. */
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
fWrite ? FOLL_WRITE | /* Write to memory. */
FOLL_FORCE /* force write access. */
: 0, /* Write to memory. */
-# else
- fWrite, /* Write to memory. */
- fWrite, /* force write access. */
-# endif
&pMemLnx->apPages[0], /* Page array. */
papVMAs); /* vmas */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
Proposed for upstream (VirtualBox):
<...>
# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
, NULL /* locked */
# endif
);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
# if LEAP_VERSION == (4, 2, 3)
rc = get_user_pages(R3Ptr,
#else
rc = get_user_pages(pTask, /* Task for fault accounting. */
pTask->mm, /* Whose pages. */
R3Ptr, /* Where from. */
cPages, /* How many pages. */
# endif
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) && (LEAP_VERSION == (4, 2, 3))
fWrite ? FOLL_WRITE | /* Write to memory. */
FOLL_FORCE /* force write access. */
: 0, /* Write to memory. */
# if LEAP_VERSION != (4, 2, 3)
fWrite, /* Write to memory. */
fWrite, /* force write access. */
# endif
&pMemLnx->apPages[0], /* Page array. */
papVMAs); /* vmas */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
<...>