[vbox-dev] Missing global with kernel 4.14-rcX

Larry Finger Larry.Finger at lwfinger.net
Tue Sep 19 15:35:52 GMT 2017


On 09/19/2017 10:10 AM, Larry Finger wrote:
> In kernel 4.14, the functions vfs_read() and vfs_write() are no longer exported. 
> This change causes vboxpci.ko to fail when it is loaded as it appears to need 
> vfs_read().
> 
> I searched the VB source code, but I do not see any direct reference to 
> vfs_read(). Why is it needed? What needs to change for kernel 4.14>
> 
> My VM's do not need vboxpci, and a quick test shows that they run under 4.14-rc1.

Sorry. The missing global is vfs_write, not vfs_read. The following patch fixes 
the build and load problem. It has been compile tested only.

Index: VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
===================================================================
--- VirtualBox-5.1.28.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
+++ VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
@@ -357,7 +357,11 @@ static int vboxPciFileWrite(struct file*

      fs_save = get_fs();
      set_fs(get_ds());
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+    ret = kernel_write(file, data, size, &offset);
+#else
      ret = vfs_write(file, data, size, &offset);
+#endif
      set_fs(fs_save);
      if (ret < 0)
          printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret);

Larry





More information about the vbox-dev mailing list