1 https://www.virtualbox.org/changeset/81586/vbox
2 https://www.virtualbox.org/changeset/81587/vbox
3 https://www.virtualbox.org/changeset/81649/vbox
5 diff -u -r VirtualBox-6.0.14/include/iprt/cdefs.h VirtualBox-6.0.14-5.4/include/iprt/cdefs.h
6 --- VirtualBox-6.0.14/include/iprt/cdefs.h 2019-10-10 18:25:42.000000000 +0000
7 +++ VirtualBox-6.0.14-5.4/include/iprt/cdefs.h 2019-11-26 10:08:56.314644140 +0000
9 * Tell the compiler that we're falling through to the next case in a switch.
11 #if RT_GNUC_PREREQ(7, 0)
12 -# define RT_FALL_THROUGH() __attribute__((fallthrough))
13 +# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
15 # define RT_FALL_THROUGH() (void)0
17 diff -u -r VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.c VirtualBox-6.0.14-5.4/src/VBox/Additions/linux/drm/vbox_drv.c
18 --- VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.c 2019-10-10 18:28:09.000000000 +0000
19 +++ VirtualBox-6.0.14-5.4/src/VBox/Additions/linux/drm/vbox_drv.c 2019-11-26 10:08:56.324644270 +0000
23 static struct drm_driver driver = {
24 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
26 DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ |
27 -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81)
28 +# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81)
31 +# endif /* < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81) */
33 +#else /* >= KERNEL_VERSION(5, 4, 0) */
34 + .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ,
35 +#endif /* < KERNEL_VERSION(5, 4, 0) */
38 .load = vbox_driver_load,
39 diff -u -r VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_main.c VirtualBox-6.0.14-5.4/src/VBox/Additions/linux/drm/vbox_main.c
40 --- VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_main.c 2019-10-10 18:28:09.000000000 +0000
41 +++ VirtualBox-6.0.14-5.4/src/VBox/Additions/linux/drm/vbox_main.c 2019-11-26 10:08:56.324644270 +0000
44 static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo)
46 -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_70)
47 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
48 + return drm_vma_node_offset_addr(&bo->bo.base.vma_node);
49 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_70)
50 return bo->bo.addr_space_offset;
52 return drm_vma_node_offset_addr(&bo->bo.vma_node);
54 +#endif /* >= KERNEL_VERSION(5, 4, 0) */
58 diff -u -r VirtualBox-6.0.14/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c VirtualBox-6.0.14-5.4/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
59 --- VirtualBox-6.0.14/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c 2019-10-10 18:35:33.000000000 +0000
60 +++ VirtualBox-6.0.14-5.4/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c 2019-11-26 10:08:56.321310893 +0000
62 for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++)
64 skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i];
65 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
66 + pSG->aSegs[iSeg].cb = pFrag->bv_len;
67 + pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
68 +# else /* < KERNEL_VERSION(5, 4, 0) */
69 pSG->aSegs[iSeg].cb = pFrag->size;
70 pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
71 +# endif /* >= KERNEL_VERSION(5, 4, 0) */
72 Log6((" %p", pSG->aSegs[iSeg].pv));
73 pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
74 Assert(iSeg <= pSG->cSegsAlloc);
76 for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++)
78 skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i];
79 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
80 + pSG->aSegs[iSeg].cb = pFrag->bv_len;
81 + pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
82 +# else /* < KERNEL_VERSION(5, 4, 0) */
83 pSG->aSegs[iSeg].cb = pFrag->size;
84 pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
85 +# endif /* >= KERNEL_VERSION(5, 4, 0) */
86 Log6((" %p", pSG->aSegs[iSeg].pv));
87 pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
88 Assert(iSeg <= pSG->cSegsAlloc);
89 diff -u -r VirtualBox-6.0.14/src/VBox/Runtime/common/fs/ntfsvfs.cpp VirtualBox-6.0.14-5.4/src/VBox/Runtime/common/fs/ntfsvfs.cpp
90 --- VirtualBox-6.0.14/src/VBox/Runtime/common/fs/ntfsvfs.cpp 2019-10-10 18:36:03.000000000 +0000
91 +++ VirtualBox-6.0.14-5.4/src/VBox/Runtime/common/fs/ntfsvfs.cpp 2019-11-26 10:08:56.317977517 +0000
93 case 4: cClustersInRun |= (uint32_t)pbPairs[offPairs + 3] << 24; RT_FALL_THRU();
94 case 3: cClustersInRun |= (uint32_t)pbPairs[offPairs + 2] << 16; RT_FALL_THRU();
95 case 2: cClustersInRun |= (uint16_t)pbPairs[offPairs + 1] << 8; RT_FALL_THRU();
96 - case 1: cClustersInRun |= (uint16_t)pbPairs[offPairs + 0] << 0; RT_FALL_THRU();
97 + case 1: cClustersInRun |= (uint16_t)pbPairs[offPairs + 0] << 0;
99 offPairs += cbRunField;
100 AssertBreakStmt(cClustersInRun <= cMaxClustersInRun,
101 diff -u -r VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
102 --- VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
103 +++ VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c 2019-11-26 10:24:51.692930759 +0000
107 SetPageReserved(&paPages[iPage]);
108 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
109 - MY_SET_PAGES_EXEC(&paPages[iPage], 1);
112 *pPhys = page_to_phys(paPages);
113 pvRet = phys_to_virt(page_to_phys(paPages));
115 for (iPage = 0; iPage < cPages; iPage++)
117 ClearPageReserved(&paPages[iPage]);
118 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
119 - MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
122 __free_pages(paPages, cOrder);
123 IPRT_LINUX_RESTORE_EFL_AC();
124 diff -u -r VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
125 --- VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
126 +++ VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c 2019-11-26 10:09:28.805069152 +0000
128 /** Set if the allocation is contiguous.
129 * This means it has to be given back as one chunk. */
131 + /** Set if executable allocation. */
133 /** Set if we've vmap'ed the memory into ring-0. */
135 /** The pages in the apPages array. */
136 @@ -289,10 +291,11 @@
137 * Only valid if fContiguous == true, ignored otherwise.
138 * @param fFlagsLnx The page allocation flags (GPFs).
139 * @param fContiguous Whether the allocation must be contiguous.
140 + * @param fExecutable Whether the memory must be executable.
141 * @param rcNoMem What to return when we're out of pages.
143 static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb,
144 - size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, int rcNoMem)
145 + size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, bool fExecutable, int rcNoMem)
148 size_t const cPages = cb >> PAGE_SHIFT;
150 for (iPage = 0; iPage < cPages; iPage++)
152 pMemLnx->apPages[iPage] = &paPages[iPage];
153 - MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
155 + MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
156 if (PageHighMem(pMemLnx->apPages[iPage]))
161 #endif /* < 2.4.22 */
162 pMemLnx->fContiguous = fContiguous;
163 + pMemLnx->fExecutable = fExecutable;
165 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
168 * This should never happen!
170 printk("rtR0MemObjLinuxAllocPages(cb=0x%lx, uAlignment=0x%lx): alloc_pages(..., %d) returned physical memory at 0x%lx!\n",
171 - (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
172 + (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
173 rtR0MemObjLinuxFreePages(pMemLnx);
176 @@ -438,14 +443,12 @@
179 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
181 - * See SetPageReserved() in rtR0MemObjLinuxAllocPages()
183 + /* See SetPageReserved() in rtR0MemObjLinuxAllocPages() */
184 ClearPageReserved(pMemLnx->apPages[iPage]);
186 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
188 - MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
189 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 22)
190 + if (pMemLnx->fExecutable)
191 + MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
195 @@ -662,10 +665,10 @@
197 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
198 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER,
199 - false /* non-contiguous */, VERR_NO_MEMORY);
200 + false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
202 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER,
203 - false /* non-contiguous */, VERR_NO_MEMORY);
204 + false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
208 @@ -696,19 +699,19 @@
209 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
210 /* ZONE_DMA32: 0-4GB */
211 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32,
212 - false /* non-contiguous */, VERR_NO_LOW_MEMORY);
213 + false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
217 /* ZONE_DMA: 0-16MB */
218 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA,
219 - false /* non-contiguous */, VERR_NO_LOW_MEMORY);
220 + false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
222 # ifdef CONFIG_X86_PAE
224 /* ZONE_NORMAL: 0-896MB */
225 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER,
226 - false /* non-contiguous */, VERR_NO_LOW_MEMORY);
227 + false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
231 @@ -738,17 +741,17 @@
232 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
233 /* ZONE_DMA32: 0-4GB */
234 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
235 - true /* contiguous */, VERR_NO_CONT_MEMORY);
236 + true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
240 /* ZONE_DMA: 0-16MB */
241 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
242 - true /* contiguous */, VERR_NO_CONT_MEMORY);
243 + true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
245 /* ZONE_NORMAL (32-bit hosts): 0-896MB */
246 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
247 - true /* contiguous */, VERR_NO_CONT_MEMORY);
248 + true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
254 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp,
255 enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */,
256 - VERR_NO_PHYS_MEMORY);
257 + false /*fExecutable*/, VERR_NO_PHYS_MEMORY);
261 diff -u -r VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
262 --- VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h 2019-10-10 18:36:16.000000000 +0000
263 +++ VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h 2019-11-26 10:09:39.218538652 +0000
267 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
268 -# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
269 -# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
270 +# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */
271 +# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
272 +# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
275 # define MY_SET_PAGES_EXEC(pPages, cPages) \
277 diff -u -r VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
278 --- VirtualBox-6.0.14/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
279 +++ VirtualBox-6.0.14-5.4/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c 2019-11-26 10:08:56.321310893 +0000
281 #include <iprt/errcore.h>
282 #include "internal/thread.h"
284 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
285 + #include <uapi/linux/sched/types.h>
286 +#endif /* >= KERNEL_VERSION(4, 11, 0) */
288 RTDECL(RTTHREAD) RTThreadSelf(void)