Fixes for Kernel >= 4.14 | libcdio-1.0.0

This commit is contained in:
layman
2017-11-26 21:44:02 +01:00
parent 9ecf863008
commit 49378e8b72
20 changed files with 927 additions and 0 deletions
@@ -0,0 +1,29 @@
#!/bin/bash
# Create a virtualbox modules tarball from a VirtualBox binary package.
# We cannot download the package by this script because of the unpredictable
# build number being in the filename.
#
# usage: create_vbox_modules_tarball.sh VirtualBox-4.1.18-78361-Linux_amd64.run
[ -f "$1" ] || exit 1
VBOX_PACKAGE="$1"
VERSION_SUFFIX=""
if [[ ${VBOX_PACKAGE} = *_BETA* ]] || [[ ${VBOX_PACKAGE} = *_RC* ]] ; then
VERSION_SUFFIX="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-[[:digit:]\.]\+\(_[[:alpha:]]\+[[:digit:]]\).*@\L\1@')"
fi
VBOX_VER="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-\([[:digit:]\.]\+\).*@\1@')${VERSION_SUFFIX}"
sh ${VBOX_PACKAGE} --noexec --keep --nox11 || exit 2
cd install || exit 3
tar -xaf VirtualBox.tar.bz2 || exit 4
cd src/vboxhost || exit 5
tar -cvJf ../../../vbox-kernel-module-src-${VBOX_VER}.tar.xz . || exit 6
cd ../../.. && rm install -rf
exit 0
@@ -0,0 +1,48 @@
diff -urp vboxdrv.orig/SUPDrvIDC.h vboxdrv/SUPDrvIDC.h
--- vboxdrv.orig/SUPDrvIDC.h 2011-09-06 15:53:27.852567531 +0200
+++ vboxdrv/SUPDrvIDC.h 2011-09-06 15:54:05.420565524 +0200
@@ -160,7 +160,7 @@ typedef struct SUPDRVIDCREQGETSYM
{
/** The symbol address. */
PFNRT pfnSymbol;
- } Out;
+ } __no_const Out;
} u;
} SUPDRVIDCREQGETSYM;
/** Pointer to a SUPDRV IDC get symbol request. */
diff -urp vboxnetflt.orig/include/VBox/intnet.h vboxnetflt/include/VBox/intnet.h
--- vboxnetflt.orig/include/VBox/intnet.h 2011-09-06 15:53:27.852567531 +0200
+++ vboxnetflt/include/VBox/intnet.h 2011-09-06 15:54:05.424565524 +0200
@@ -783,7 +783,7 @@ typedef struct INTNETTRUNKFACTORY
DECLR0CALLBACKMEMBER(int, pfnCreateAndConnect,(struct INTNETTRUNKFACTORY *pIfFactory, const char *pszName,
PINTNETTRUNKSWPORT pSwitchPort, uint32_t fFlags,
PINTNETTRUNKIFPORT *ppIfPort));
-} INTNETTRUNKFACTORY;
+} __no_const INTNETTRUNKFACTORY;
/** Pointer to the trunk factory. */
typedef INTNETTRUNKFACTORY *PINTNETTRUNKFACTORY;
diff -urp vboxnetflt.orig/linux/VBoxNetFlt-linux.c vboxnetflt/linux/VBoxNetFlt-linux.c
--- vboxnetflt.orig/linux/VBoxNetFlt-linux.c 2011-07-19 12:15:22.000000000 +0200
+++ vboxnetflt/linux/VBoxNetFlt-linux.c 2011-09-06 15:56:00.516559379 +0200
@@ -840,7 +840,7 @@ typedef struct ethtool_ops OVR_OPSTYPE;
# else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) */
-typedef struct net_device_ops OVR_OPSTYPE;
+typedef net_device_ops_no_const OVR_OPSTYPE;
# define OVR_OPS netdev_ops
# define OVR_XMIT pOrgOps->ndo_start_xmit
diff -urp vboxpci.orig/include/VBox/rawpci.h vboxpci/include/VBox/rawpci.h
--- vboxpci.orig/include/VBox/rawpci.h 2011-04-18 17:01:12.000000000 +0200
+++ vboxpci/include/VBox/rawpci.h 2011-09-06 15:57:17.340555277 +0200
@@ -545,7 +545,7 @@ typedef struct RAWPCIFACTORY
DECLR0CALLBACKMEMBER(void, pfnDeinitVm,(PRAWPCIFACTORY pFactory,
PVM pVM,
PRAWPCIPERVM pPciData));
-} RAWPCIFACTORY;
+} __no_const RAWPCIFACTORY;
#define RAWPCIFACTORY_UUID_STR "ea089839-4171-476f-adfb-9e7ab1cbd0fb"
@@ -0,0 +1,12 @@
Index: trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
===================================================================
--- a/vboxdrv/SUPDrvInternal.h
+++ b/vboxdrv/SUPDrvInternal.h
@@ -65,7 +65,4 @@
# include <linux/modversions.h>
# endif
-# endif
-# if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
-# undef ALIGN
# endif
# ifndef KBUILD_STR
@@ -0,0 +1,35 @@
diff --git a/work/vboxnetflt/linux/VBoxNetFlt-linux.c b/work/vboxnetflt/linux/VBoxNetFlt-linux.c
index f824654..b61d82c 100644
--- work/vboxnetflt/linux/VBoxNetFlt-linux.c
+++ work/vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -126,6 +126,10 @@ typedef struct VBOXNETFLTNOTIFIER *PVBOXNETFLTNOTIFIER;
# endif
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+#define SKB_GSO_UDP 0
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
# define VBOX_HAVE_SKB_VLAN
#else
diff --git a/work/vboxpci/linux/VBoxPci-linux.c b/work/vboxpci/linux/VBoxPci-linux.c
index 2dbf47f..e361ef3 100644
--- work/vboxpci/linux/VBoxPci-linux.c
+++ work/vboxpci/linux/VBoxPci-linux.c
@@ -353,12 +353,16 @@ static void vboxPciFileClose(struct file* file)
static int vboxPciFileWrite(struct file* file, unsigned long long offset, unsigned char* data, unsigned int size)
{
int ret;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+ ret = kernel_write(file, data, size, &offset);
+#else
mm_segment_t fs_save;
fs_save = get_fs();
set_fs(get_ds());
ret = vfs_write(file, data, size, &offset);
set_fs(fs_save);
+#endif
if (ret < 0)
printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret);
@@ -0,0 +1,35 @@
diff --git a/work/vboxdrv/r0drv/linux/timer-r0drv-linux.c b/work/vboxdrv/r0drv/linux/timer-r0drv-linux.c
index 2bb2bfb..3b4a508 100644
--- work/vboxdrv/r0drv/linux/timer-r0drv-linux.c
+++ work/vboxdrv/r0drv/linux/timer-r0drv-linux.c
@@ -720,9 +720,9 @@ static enum hrtimer_restart rtTimerLinuxHrCallback(struct hrtimer *pHrTimer)
*
* @param ulUser Address of the sub-timer structure.
*/
-static void rtTimerLinuxStdCallback(unsigned long ulUser)
+static void rtTimerLinuxStdCallback(struct timer_list *t)
{
- PRTTIMERLNXSUBTIMER pSubTimer = (PRTTIMERLNXSUBTIMER)ulUser;
+ PRTTIMERLNXSUBTIMER pSubTimer = from_timer(pSubTimer,t,u.Std.LnxTimer);
PRTTIMER pTimer = pSubTimer->pParent;
RTTIMERLNX_LOG(("stdcallback %p\n", pTimer));
@@ -1584,6 +1584,10 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
else
#endif
{
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+ timer_setup(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer,rtTimerLinuxStdCallback,TIMER_PINNED);
+#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
init_timer_pinned(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer);
#else
@@ -1591,6 +1595,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
#endif
pTimer->aSubTimers[iCpu].u.Std.LnxTimer.data = (unsigned long)&pTimer->aSubTimers[iCpu];
pTimer->aSubTimers[iCpu].u.Std.LnxTimer.function = rtTimerLinuxStdCallback;
+#endif
pTimer->aSubTimers[iCpu].u.Std.LnxTimer.expires = jiffies;
pTimer->aSubTimers[iCpu].u.Std.u64NextTS = 0;
}
@@ -0,0 +1,60 @@
diff -ru3 vbox-kernel-module-src-5.1.22.old/vboxdrv/include/iprt/string.h vbox-kernel-module-src-5.1.22/vboxdrv/include/iprt/string.h
--- vbox-kernel-module-src-5.1.22.old/vboxdrv/include/iprt/string.h 2017-04-05 16:52:55.000000000 +0300
+++ vbox-kernel-module-src-5.1.22/vboxdrv/include/iprt/string.h 2017-07-05 01:25:52.712343705 +0300
@@ -32,11 +32,7 @@
#include <iprt/stdarg.h>
#include <iprt/err.h> /* for VINF_SUCCESS */
#if defined(RT_OS_LINUX) && defined(__KERNEL__)
- RT_C_DECLS_BEGIN
-# define new newhack /* string.h: strreplace */
# include <linux/string.h>
-# undef new
- RT_C_DECLS_END
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
RT_C_DECLS_BEGIN
diff -ru3 vbox-kernel-module-src-5.1.22.old/vboxnetadp/include/iprt/string.h vbox-kernel-module-src-5.1.22/vboxnetadp/include/iprt/string.h
--- vbox-kernel-module-src-5.1.22.old/vboxnetadp/include/iprt/string.h 2017-04-05 16:52:55.000000000 +0300
+++ vbox-kernel-module-src-5.1.22/vboxnetadp/include/iprt/string.h 2017-07-05 01:25:52.712343705 +0300
@@ -32,11 +32,7 @@
#include <iprt/stdarg.h>
#include <iprt/err.h> /* for VINF_SUCCESS */
#if defined(RT_OS_LINUX) && defined(__KERNEL__)
- RT_C_DECLS_BEGIN
-# define new newhack /* string.h: strreplace */
# include <linux/string.h>
-# undef new
- RT_C_DECLS_END
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
RT_C_DECLS_BEGIN
diff -ru3 vbox-kernel-module-src-5.1.22.old/vboxnetflt/include/iprt/string.h vbox-kernel-module-src-5.1.22/vboxnetflt/include/iprt/string.h
--- vbox-kernel-module-src-5.1.22.old/vboxnetflt/include/iprt/string.h 2017-04-05 16:52:55.000000000 +0300
+++ vbox-kernel-module-src-5.1.22/vboxnetflt/include/iprt/string.h 2017-07-05 01:25:52.712343705 +0300
@@ -32,11 +32,7 @@
#include <iprt/stdarg.h>
#include <iprt/err.h> /* for VINF_SUCCESS */
#if defined(RT_OS_LINUX) && defined(__KERNEL__)
- RT_C_DECLS_BEGIN
-# define new newhack /* string.h: strreplace */
# include <linux/string.h>
-# undef new
- RT_C_DECLS_END
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
RT_C_DECLS_BEGIN
diff -ru3 vbox-kernel-module-src-5.1.22.old/vboxpci/include/iprt/string.h vbox-kernel-module-src-5.1.22/vboxpci/include/iprt/string.h
--- vbox-kernel-module-src-5.1.22.old/vboxpci/include/iprt/string.h 2017-04-05 16:52:55.000000000 +0300
+++ vbox-kernel-module-src-5.1.22/vboxpci/include/iprt/string.h 2017-07-05 01:25:52.712343705 +0300
@@ -32,11 +32,7 @@
#include <iprt/stdarg.h>
#include <iprt/err.h> /* for VINF_SUCCESS */
#if defined(RT_OS_LINUX) && defined(__KERNEL__)
- RT_C_DECLS_BEGIN
-# define new newhack /* string.h: strreplace */
# include <linux/string.h>
-# undef new
- RT_C_DECLS_END
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
RT_C_DECLS_BEGIN
@@ -0,0 +1,93 @@
diff -ruN vboxhost.orig/vboxdrv/linux/SUPDrv-linux.c vboxhost/vboxdrv/linux/SUPDrv-linux.c
--- vboxhost.orig/vboxdrv/linux/SUPDrv-linux.c 2016-08-22 00:00:00.000000000 +0200
+++ vboxhost/vboxdrv/linux/SUPDrv-linux.c 2017-05-31 19:00:22.887324690 +0200
@@ -1397,7 +1397,7 @@
SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
{
uint32_t fFlags = 0;
-#ifdef CONFIG_PAX_KERNEXEC
+#if defined(CONFIG_PAX_KERNEXEC) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
fFlags |= SUPKERNELFEATURES_GDT_READ_ONLY;
#endif
#if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
diff -ruN vboxhost.orig/vboxdrv/r0drv/linux/alloc-r0drv-linux.c vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
--- vboxhost.orig/vboxdrv/r0drv/linux/alloc-r0drv-linux.c 2016-08-22 00:00:00.000000000 +0200
+++ vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c 2017-05-31 19:03:32.465413475 +0200
@@ -35,7 +35,10 @@
#include <iprt/assert.h>
#include <iprt/err.h>
#include "r0drv/alloc-r0drv.h"
-
+#include <linux/kmemleak.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#include <asm/set_memory.h>
+#endif
#if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && !defined(RTMEMALLOC_EXEC_HEAP)
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
diff -ruN vboxhost.orig/vboxdrv/r0drv/linux/memobj-r0drv-linux.c vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
--- vboxhost.orig/vboxdrv/r0drv/linux/memobj-r0drv-linux.c 2017-02-02 16:54:00.000000000 +0100
+++ vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c 2017-05-31 19:23:05.187059423 +0200
@@ -899,6 +899,9 @@
unsigned long pfn;
struct page *pPage;
pte_t *pEntry;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d_t p4d;
+#endif
union
{
pgd_t Global;
@@ -917,9 +920,18 @@
u.Global = *pgd_offset(current->active_mm, ulAddr);
if (RT_UNLIKELY(pgd_none(u.Global)))
return NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d = *p4d_offset(&u.Global, ulAddr);
+ if (RT_UNLIKELY(p4d_none(p4d) || p4d_large(p4d) || !p4d_present(p4d)))
+ return NULL;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ u.Upper = *pud_offset(&p4d, ulAddr);
+#else
u.Upper = *pud_offset(&u.Global, ulAddr);
+#endif
if (RT_UNLIKELY(pud_none(u.Upper)))
return NULL;
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
@@ -1463,13 +1475,23 @@
{
int rc = -ENOMEM;
pgd_t *pgd;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d_t *p4d;
+#endif
spin_lock(&mm->page_table_lock);
pgd = pgd_offset(mm, ulAddr);
if (!pgd_none(*pgd) && !pgd_bad(*pgd))
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d = p4d_offset(*pgd, ulAddr);
+ if (p4d_none(*p4d))
+ goto exit;
+ pmd_t *pmd = pmd_offset(p4d, ulAddr);
+#else
pmd_t *pmd = pmd_offset(pgd, ulAddr);
+#endif
if (!pmd_none(*pmd))
{
pte_t *ptep = pte_offset_map(pmd, ulAddr);
@@ -1487,6 +1509,9 @@
}
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+exit:
+#endif
spin_unlock(&mm->page_table_lock);
return rc;
}
@@ -0,0 +1,4 @@
vboxnetflt
vboxnetadp
vboxdrv
vboxpci