commit 80ae93d8474d8c22cf1adba4e0a9c1dc59192a89
Author: Sérgio M. Basto <sergio(a)serjux.com>
Date: Thu Oct 3 05:37:21 2019 +0100
Fixes for kernel 5.4
VirtualBox-kmod.spec | 7 +++-
fixes_for_5.4.patch | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 120 insertions(+), 1 deletion(-)
---
diff --git a/VirtualBox-kmod.spec b/VirtualBox-kmod.spec
index 880ad4e..a8dba05 100644
--- a/VirtualBox-kmod.spec
+++ b/VirtualBox-kmod.spec
@@ -45,7 +45,7 @@
Name: VirtualBox-kmod
Version: 6.0.12
-Release: 2%{?dist}
+Release: 3%{?dist}
#Release: 1%%{?prerel:.%%{prerel}}%%{?dist}
Summary: Kernel module for VirtualBox
@@ -58,6 +58,7 @@ Source2:
https://github.com/jwrdegoede/vboxsf/archive/%{shortcommit1}.zip
Patch1: Fixes_for_Kernel_5.3.patch
Patch2: kernel-5.patch
Patch3: kernel-el7.7.patch
+Patch4: fixes_for_5.4.patch
%global AkmodsBuildRequires %{_bindir}/kmodtool, VirtualBox-kmodsrc >=
%{version}%{vboxreltag}, xz, time
@@ -91,6 +92,7 @@ unzip %{SOURCE2}
mv vboxsf-%{commit1}/ vboxsf/
%endif
%patch3 -p1
+%patch4 -p1
popd
@@ -152,6 +154,9 @@ DIRS=$(ls %{name}-%{version} |wc -l)
%changelog
+* Thu Oct 03 2019 Sérgio Basto <sergio(a)serjux.com> - 6.0.12-3
+- Fixes for kernel 5.4
+
* Sat Sep 14 2019 Sérgio Basto <sergio(a)serjux.com> - 6.0.12-2
- Add patch for kernel of EL 7.7
diff --git a/fixes_for_5.4.patch b/fixes_for_5.4.patch
new file mode 100644
index 0000000..deeabea
--- /dev/null
+++ b/fixes_for_5.4.patch
@@ -0,0 +1,114 @@
+Index: VirtualBox-6.0.12/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
+===================================================================
+--- VirtualBox-6.0.12.orig/vboxnetflt/linux/VBoxNetFlt-linux.c
++++ VirtualBox-6.0.12/vboxnetflt/linux/VBoxNetFlt-linux.c
+@@ -924,8 +924,13 @@ static void vboxNetFltLinuxSkBufToSG(PVB
+ for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++)
+ {
+ skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i];
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++ pSG->aSegs[iSeg].cb = pFrag->bv_len;
++ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
++#else
+ pSG->aSegs[iSeg].cb = pFrag->size;
+ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
++#endif
+ Log6((" %p", pSG->aSegs[iSeg].pv));
+ pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
+ Assert(iSeg <= pSG->cSegsAlloc);
+@@ -940,8 +945,13 @@ static void vboxNetFltLinuxSkBufToSG(PVB
+ for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++)
+ {
+ skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i];
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++ pSG->aSegs[iSeg].cb = pFrag->bv_len;
++ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
++#else
+ pSG->aSegs[iSeg].cb = pFrag->size;
+ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
++#endif
+ Log6((" %p", pSG->aSegs[iSeg].pv));
+ pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
+ Assert(iSeg <= pSG->cSegsAlloc);
+Index: VirtualBox-6.0.12/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.0.12.orig/vboxguest/r0drv/linux/alloc-r0drv-linux.c
++++ VirtualBox-6.0.12/vboxguest/r0drv/linux/alloc-r0drv-linux.c
+@@ -444,8 +444,10 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHY
+
+ SetPageReserved(&paPages[iPage]);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel
where change_page_attr was introduced. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ MY_SET_PAGES_EXEC(&paPages[iPage], 1);
+ #endif
++#endif
+ }
+ *pPhys = page_to_phys(paPages);
+ pvRet = phys_to_virt(page_to_phys(paPages));
+@@ -492,8 +494,10 @@ RTR0DECL(void) RTMemContFree(void *pv, s
+ {
+ ClearPageReserved(&paPages[iPage]);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel
where change_page_attr was introduced. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
+ #endif
++#endif
+ }
+ __free_pages(paPages, cOrder);
+ IPRT_LINUX_RESTORE_EFL_AC();
+Index: VirtualBox-6.0.12/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.0.12.orig/vboxguest/r0drv/linux/thread2-r0drv-linux.c
++++ VirtualBox-6.0.12/vboxguest/r0drv/linux/thread2-r0drv-linux.c
+@@ -36,6 +36,9 @@
+ #include <iprt/errcore.h>
+ #include "internal/thread.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++#include <uapi/linux/sched/types.h>
++#endif
+
+ RTDECL(RTTHREAD) RTThreadSelf(void)
+ {
+
+Index: VirtualBox-6.0.12/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.0.12.orig/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
++++ VirtualBox-6.0.12/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
+@@ -444,8 +444,10 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHY
+
+ SetPageReserved(&paPages[iPage]);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel
where change_page_attr was introduced. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ MY_SET_PAGES_EXEC(&paPages[iPage], 1);
+ #endif
++#endif
+ }
+ *pPhys = page_to_phys(paPages);
+ pvRet = phys_to_virt(page_to_phys(paPages));
+@@ -492,8 +494,10 @@ RTR0DECL(void) RTMemContFree(void *pv, s
+ {
+ ClearPageReserved(&paPages[iPage]);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel
where change_page_attr was introduced. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
+ #endif
++#endif
+ }
+ __free_pages(paPages, cOrder);
+ IPRT_LINUX_RESTORE_EFL_AC();
+Index: VirtualBox-6.0.12/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.0.12.orig/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
++++ VirtualBox-6.0.12/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
+@@ -36,6 +36,9 @@
+ #include <iprt/errcore.h>
+ #include "internal/thread.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++#include <uapi/linux/sched/types.h>
++#endif
+
+ RTDECL(RTTHREAD) RTThreadSelf(void)
+ {
+