[vbox-dev] VirtualBox 6.0 - build fix for Linux 5.1

Michael Thayer michael.thayer at oracle.com
Fri Mar 29 20:06:21 GMT 2019


Hello Larry,

Sorry, got sidetracked here again.  As of yesterday trunk, 6.0 and 5.2
should all work well with Linux 5.0 and 5.1.  Thank you!

Regards
Michael

20.03.19 20:39, Larry Finger wrote:
> On 3/14/19 3:57 PM, Valdis Klētnieks wrote:
>> Sayeth Linus:
>>
>> commit 736706bee3298208343a76096370e4f6a5c55915
>> Author: Linus Torvalds <torvalds at linux-foundation.org>
>> Date:   Mon Mar 4 10:39:05 2019 -0800
>>
>>      get rid of legacy 'get_ds()' function
>>           Every in-kernel use of this function defined it to KERNEL_DS
>> (either as
>>      an actual define, or as an inline function).  It's an entirely
>>      historical artifact, and long long long ago used to actually read
>> the
>>      segment selector valueof '%ds' on x86.
>>           Which in the kernel is always KERNEL_DS.
>>
>> No kernel release versioning on the patch, as the define was in the tree
>> when Linus did the initial import into git for v2.6.12-rc2 back in
>> April 2005.
>> If you're trying to build this on a kernel older than that, this is
>> the least of
>> your problems. :)
>>
>> --- vboxhost/vboxpci/linux/VBoxPci-linux.c.dist    2019-03-14
>> 16:37:18.758730554 -0400
>> +++vboxhost/vboxpci/linux/VBoxPci-linux.c    2019-03-14
>> 16:37:46.354160251 -0400
>> @@ -372,7 +372,7 @@ static int vboxPciFileWrite(struct file*
>>       mm_segment_t fs_save;
>>         fs_save = get_fs();
>> -    set_fs(get_ds());
>> +    set_fs(KERNEL_DS);
>>   #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
>>       ret = kernel_write(file, data, size, &offset);
>>   #else
> 
> On openSUSE, I found two additional incompatibilities with kernel 5.1.
> My resulting patch with MIT license is
> 
> Index: VirtualBox-6.0.4/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
> ===================================================================
> --- VirtualBox-6.0.4.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
> +++ VirtualBox-6.0.4/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
> @@ -38,6 +38,9 @@
>  #include <iprt/process.h>
>  #include <iprt/string.h>
>  #include "internal/memobj.h"
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
> +#include <uapi/linux/mman.h>
> +#endif
> 
> 
> 
> /*********************************************************************************************************************************
> 
> Index: VirtualBox-6.0.4/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
> ===================================================================
> ---
> VirtualBox-6.0.4.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
> +++ VirtualBox-6.0.4/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
> @@ -372,7 +372,7 @@ static int vboxPciFileWrite(struct file*
>      mm_segment_t fs_save;
> 
>      fs_save = get_fs();
> -    set_fs(get_ds());
> +    set_fs(KERNEL_DS);
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
>      ret = kernel_write(file, data, size, &offset);
>  #else
> Index: VirtualBox-6.0.4/src/VBox/Additions/linux/sharedfolders/regops.c
> ===================================================================
> --- VirtualBox-6.0.4.orig/src/VBox/Additions/linux/sharedfolders/regops.c
> +++ VirtualBox-6.0.4/src/VBox/Additions/linux/sharedfolders/regops.c
> @@ -588,7 +588,9 @@ static int sf_reg_release(struct inode *
>         return 0;
>  }
> 
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
> +static vm_fault_t sf_reg_fault(struct vm_fault *vmf)
> +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
>  static int sf_reg_fault(struct vm_fault *vmf)
>  #elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
>  static int sf_reg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> 
> Larry
> 
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev

-- 
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2468 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20190329/46e54c08/attachment.bin>


More information about the vbox-dev mailing list