diff -Nru virtualbox-hwe-5.0.40-dfsg/debian/changelog virtualbox-hwe-5.0.40-dfsg/debian/changelog --- virtualbox-hwe-5.0.40-dfsg/debian/changelog 2017-07-11 06:02:00.000000000 +0000 +++ virtualbox-hwe-5.0.40-dfsg/debian/changelog 2017-11-10 08:53:26.000000000 +0000 @@ -1,3 +1,22 @@ +virtualbox-hwe (5.0.40-dfsg-0ubuntu1.16.04.1~16.04.4) xenial; urgency=medium + + * Provide vboxguest-hwe, to avoid clash with old package + (residual config is not purged on removal LP: #1708315) + + -- Gianfranco Costamagna Fri, 10 Nov 2017 09:53:26 +0100 + +virtualbox (5.0.40-dfsg-0ubuntu1.16.04.3) xenial; urgency=medium + + * Tweak and reduce previous patch + + -- Gianfranco Costamagna Thu, 09 Nov 2017 11:23:02 +0100 + +virtualbox (5.0.40-dfsg-0ubuntu1.16.04.2) xenial; urgency=medium + + * Fix kernel module build with new kernel 4.13 (LP: #1729568) + + -- Gianfranco Costamagna Mon, 06 Nov 2017 18:41:59 +0100 + virtualbox-hwe (5.0.40-dfsg-0ubuntu1.16.04.1~16.04.3) xenial; urgency=medium * Backport to xenial. (LP: #1687981) diff -Nru virtualbox-hwe-5.0.40-dfsg/debian/patches/kernel-4.13.patch virtualbox-hwe-5.0.40-dfsg/debian/patches/kernel-4.13.patch --- virtualbox-hwe-5.0.40-dfsg/debian/patches/kernel-4.13.patch 1970-01-01 00:00:00.000000000 +0000 +++ virtualbox-hwe-5.0.40-dfsg/debian/patches/kernel-4.13.patch 2017-11-09 10:23:43.000000000 +0000 @@ -0,0 +1,228 @@ +Description: take the whole directory from virtualbox 5.2.0 + +--- virtualbox-5.0.40-dfsg.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c ++++ virtualbox-5.0.40-dfsg/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +@@ -901,6 +902,9 @@ static struct page *rtR0MemObjLinuxVirtT + union + { + pgd_t Global; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ p4d_t Four; ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + pud_t Upper; + #endif +@@ -916,9 +920,24 @@ static struct page *rtR0MemObjLinuxVirtT + u.Global = *pgd_offset(current->active_mm, ulAddr); + if (RT_UNLIKELY(pgd_none(u.Global))) + return NULL; +- + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) ++# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ u.Four = *p4d_offset(&u.Global, ulAddr); ++ if (RT_UNLIKELY(p4d_none(u.Four))) ++ return NULL; ++ if (p4d_large(u.Four)) ++ { ++ pPage = p4d_page(u.Four); ++ AssertReturn(pPage, NULL); ++ pfn = page_to_pfn(pPage); /* doing the safe way... */ ++ AssertCompile(P4D_SHIFT - PAGE_SHIFT < 31); ++ pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (P4D_SHIFT - PAGE_SHIFT)) - 1); ++ return pfn_to_page(pfn); ++ } ++ u.Upper = *pud_offset(&u.Four, ulAddr); ++# else /* < 4.12 */ + u.Upper = *pud_offset(&u.Global, ulAddr); ++# endif /* < 4.12 */ + if (RT_UNLIKELY(pud_none(u.Upper))) + return NULL; + # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) +@@ -1007,6 +1025,14 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhy + return VINF_SUCCESS; + } + ++/* openSUSE Leap 42.3 detection :-/ */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) \ ++ && LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) \ ++ && defined(FAULT_FLAG_REMOTE) ++# define GET_USER_PAGES_API KERNEL_VERSION(4, 10, 0) /* no typo! */ ++#else ++# define GET_USER_PAGES_API LINUX_VERSION_CODE ++#endif + + DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) + { +@@ -1044,11 +1070,11 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser + /* + * Get user pages. + */ +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) ++#if GET_USER_PAGES_API >= KERNEL_VERSION(4, 6, 0) + if (R0Process == RTR0ProcHandleSelf()) + rc = get_user_pages(R3Ptr, /* Where from. */ + cPages, /* How many pages. */ +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++# if GET_USER_PAGES_API >= KERNEL_VERSION(4, 9, 0) + fWrite ? FOLL_WRITE | /* Write to memory. */ + FOLL_FORCE /* force write access. */ + : 0, /* Write to memory. */ +@@ -1068,7 +1094,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser + pTask->mm, /* Whose pages. */ + R3Ptr, /* Where from. */ + cPages, /* How many pages. */ +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++# if GET_USER_PAGES_API >= KERNEL_VERSION(4, 9, 0) + fWrite ? FOLL_WRITE | /* Write to memory. */ + FOLL_FORCE /* force write access. */ + : 0, /* Write to memory. */ +@@ -1078,16 +1104,16 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser + # endif + &pMemLnx->apPages[0], /* Page array. */ + papVMAs /* vmas */ +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) ++# if GET_USER_PAGES_API >= KERNEL_VERSION(4, 10, 0) + , NULL /* locked */ + # endif + ); +-#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */ ++#else /* GET_USER_PAGES_API < KERNEL_VERSION(4, 6, 0) */ + rc = get_user_pages(pTask, /* Task for fault accounting. */ + pTask->mm, /* Whose pages. */ + R3Ptr, /* Where from. */ + cPages, /* How many pages. */ +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++# if GET_USER_PAGES_API >= KERNEL_VERSION(4, 9, 0) + fWrite ? FOLL_WRITE | /* Write to memory. */ + FOLL_FORCE /* force write access. */ + : 0, /* Write to memory. */ +@@ -1097,7 +1123,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser + # endif + &pMemLnx->apPages[0], /* Page array. */ + papVMAs); /* vmas */ +-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */ ++#endif /* GET_USER_PAGES_API < KERNEL_VERSION(4, 6, 0) */ + if (rc == cPages) + { + /* +--- virtualbox-5.0.40-dfsg.orig/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c ++++ virtualbox-5.0.40-dfsg/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c +@@ -4,7 +4,7 @@ + */ + + /* +- * Copyright (C) 2009-2015 Oracle Corporation ++ * Copyright (C) 2009-2017 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; +--- virtualbox-5.0.40-dfsg.orig/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c ++++ virtualbox-5.0.40-dfsg/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c +@@ -4,7 +4,7 @@ + */ + + /* +- * Copyright (C) 2008-2015 Oracle Corporation ++ * Copyright (C) 2008-2017 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; +@@ -384,7 +384,10 @@ RTDECL(int) RTMpOnPair(RTCPUID idCpu1, R + * CPUs is the one we're running on, we must do the call and the post + * call wait ourselves. + */ +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++ /* 2.6.28 introduces CONFIG_CPUMASK_OFFSTACK */ ++ cpumask_var_t DstCpuMask; ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + cpumask_t DstCpuMask; + #endif + RTCPUID idCpuSelf = RTMpCpuId(); +@@ -397,10 +400,17 @@ RTDECL(int) RTMpOnPair(RTCPUID idCpu1, R + Args.idCpu2 = idCpu2; + Args.cHits = 0; + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) +- cpumask_clear(&DstCpuMask); +- cpumask_set_cpu(idCpu1, &DstCpuMask); +- cpumask_set_cpu(idCpu2, &DstCpuMask); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) ++ if (!zalloc_cpumask_var(&DstCpuMask, GFP_KERNEL)) ++ return VERR_NO_MEMORY; ++ cpumask_set_cpu(idCpu1, DstCpuMask); ++ cpumask_set_cpu(idCpu2, DstCpuMask); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++ if (!alloc_cpumask_var(&DstCpuMask, GFP_KERNEL)) ++ return VERR_NO_MEMORY; ++ cpumask_clear(DstCpuMask); ++ cpumask_set_cpu(idCpu1, DstCpuMask); ++ cpumask_set_cpu(idCpu2, DstCpuMask); + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + cpus_clear(DstCpuMask); + cpu_set(idCpu1, DstCpuMask); +@@ -408,7 +418,7 @@ RTDECL(int) RTMpOnPair(RTCPUID idCpu1, R + #endif + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) +- smp_call_function_many(&DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */); ++ smp_call_function_many(DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */); + rc = 0; + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + rc = smp_call_function_mask(DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */); +@@ -440,6 +450,10 @@ RTDECL(int) RTMpOnPair(RTCPUID idCpu1, R + rc = VERR_CPU_OFFLINE; + else + rc = VERR_CPU_IPE_1; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++ free_cpumask_var(DstCpuMask); ++#endif + } + /* + * A CPU must be present to be considered just offline. +--- virtualbox-5.0.40-dfsg.orig/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h ++++ virtualbox-5.0.40-dfsg/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +@@ -34,6 +34,16 @@ + #include + #define bool linux_bool + ++#if RT_GNUC_PREREQ(4, 6) ++# pragma GCC diagnostic push ++#endif ++#if RT_GNUC_PREREQ(4, 2) ++# pragma GCC diagnostic ignored "-Wunused-parameter" ++# if !defined(__cplusplus) && RT_GNUC_PREREQ(4, 3) ++# pragma GCC diagnostic ignored "-Wold-style-declaration" /* 2.6.18-411.0.0.0.1.el5/build/include/asm/apic.h:110: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] */ ++# endif ++#endif ++ + #include + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) + # include +@@ -149,6 +159,11 @@ + # include + #endif + ++/* for set_pages_x() */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++# include ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) + # include + #else +--- virtualbox-5.0.40-dfsg.orig/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h ++++ virtualbox-5.0.40-dfsg/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h +@@ -46,7 +46,11 @@ + typedef struct RTR0SEMLNXWAIT + { + /** The wait queue entry. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ wait_queue_entry_t WaitQE; ++#else + wait_queue_t WaitQE; ++#endif + /** The absolute timeout given as nano seconds since the start of the + * monotonic clock. */ + uint64_t uNsAbsTimeout; diff -Nru virtualbox-hwe-5.0.40-dfsg/debian/patches/series virtualbox-hwe-5.0.40-dfsg/debian/patches/series --- virtualbox-hwe-5.0.40-dfsg/debian/patches/series 2017-07-11 06:02:00.000000000 +0000 +++ virtualbox-hwe-5.0.40-dfsg/debian/patches/series 2017-11-06 21:44:12.000000000 +0000 @@ -15,3 +15,4 @@ 35-libvdeplug-soname.patch 36-fix-vnc-version-string.patch new-xorg-1.19.patch +kernel-4.13.patch diff -Nru virtualbox-hwe-5.0.40-dfsg/debian/virtualbox-guest-utils-hwe.init virtualbox-hwe-5.0.40-dfsg/debian/virtualbox-guest-utils-hwe.init --- virtualbox-hwe-5.0.40-dfsg/debian/virtualbox-guest-utils-hwe.init 2017-07-11 06:02:00.000000000 +0000 +++ virtualbox-hwe-5.0.40-dfsg/debian/virtualbox-guest-utils-hwe.init 2017-11-06 21:42:44.000000000 +0000 @@ -2,7 +2,7 @@ # (C) 2007 Michael Meskes ### BEGIN INIT INFO -# Provides: vboxguest virtualbox-guest-utils +# Provides: vboxguest-hwe virtualbox-guest-utils-hwe # Short-Description: VirtualBox Linux Additions # Required-Start: $remote_fs # Required-Stop: $remote_fs