[vbox-dev] Virtualbox 5.1.26 problem with kernel 4.4.76/79 and x86_64

Larry Finger Larry.Finger at lwfinger.net
Thu Aug 10 15:26:50 GMT 2017


On 08/09/2017 11:00 AM, Ingmar Sittl wrote:
> Hello,
> 
> I ran into a problem with Virtualbox 5.1.26 and Linux kernels 4.4.76 and 4.4.79 
> on x86_64 when trying to build the kernel module:
> 
> /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1117:33: error: too many arguments 
> to function ‘get_user_pages’
>                                   papVMAs);               /* vmas */
>                                   ^
> In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:98:0,
>                   from /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:31:
> /usr/src/linux-4.4.76-1/include/linux/mm.h:1264:6: note: declared here
>   long get_user_pages(unsigned long start, unsigned long nr_pages,
>        ^
> /usr/src/linux-4.4.76-1/scripts/Makefile.build:259: recipe for target 
> '/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o' failed
> 
> Looking at the signature of get_user_pages() and the provided parameters, it 
> looks to me like get_user_pages() is the wrong function to call here, at least 
> on the 4.4 kernel series. The function signature and provided parameters match 
> get_user_pages_remote() instead, replacing the call then made the kernel module 
> compile successfully and afterwards start without issues:
> 
> --- ./src/vboxguest-5.1.26/vboxguest/r0drv/linux/memobj-r0drv-linux.c 2017-08-09 
> 17:56:34.080441174 +0200
> +++ ./src/vboxguest-5.1.26/vboxguest/r0drv/linux/memobj-r0drv-linux.c.new 
> 2017-08-09 17:33:08.004000000 +0200
> @@ -1101,7 +1101,7 @@
>   # endif
>                                   );
>   #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
> -            rc = get_user_pages(pTask,                  /* Task for fault 
> accounting. */
> +            rc = get_user_pages_remote(pTask,                  /* Task for 
> fault accounting. */
>                                   pTask->mm, /* Whose pages. */
>                                   R3Ptr,                  /* Where from. */
>                                   cPages,                 /* How many pages. */
> 
> Perhaps this needs to be #ifdef'ed further based on kernel versions.

Are you running openSUSE Leap 42.3, or has someone else stupidly backported the 
get_user_pages() API from kernel 4.9 back to 4.4?

If you were using a stock 4.4 kernel, then there would be no need for any 
changes. In fact, applying the kind of ifdef statements that you recommend would 
break the builds for all the people running kernels that actually follow the 
rules regarding API changes. Such modifications to an API should only occur with 
a major version change!

Larry





More information about the vbox-dev mailing list