]>
Commit | Line | Data |
---|---|---|
c04fa1d9 JP |
1 | https://www.virtualbox.org/changeset/81586/vbox |
2 | https://www.virtualbox.org/changeset/81587/vbox | |
3 | https://www.virtualbox.org/changeset/81649/vbox | |
4 | ||
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 | |
8 | @@ -1166,7 +1166,7 @@ | |
9 | * Tell the compiler that we're falling through to the next case in a switch. | |
10 | * @sa RT_FALL_THRU */ | |
11 | #if RT_GNUC_PREREQ(7, 0) | |
12 | -# define RT_FALL_THROUGH() __attribute__((fallthrough)) | |
13 | +# define RT_FALL_THROUGH() __attribute__((__fallthrough__)) | |
14 | #else | |
15 | # define RT_FALL_THROUGH() (void)0 | |
16 | #endif | |
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 | |
20 | @@ -270,12 +270,16 @@ | |
21 | } | |
22 | ||
23 | static struct drm_driver driver = { | |
24 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) | |
25 | .driver_features = | |
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) | |
29 | DRIVER_IRQ_SHARED | | |
30 | -#endif | |
31 | +# endif /* < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81) */ | |
32 | DRIVER_PRIME, | |
33 | +#else /* >= KERNEL_VERSION(5, 4, 0) */ | |
34 | + .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ, | |
35 | +#endif /* < KERNEL_VERSION(5, 4, 0) */ | |
36 | .dev_priv_size = 0, | |
37 | ||
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 | |
42 | @@ -616,11 +616,13 @@ | |
43 | ||
44 | static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo) | |
45 | { | |
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; | |
51 | #else | |
52 | return drm_vma_node_offset_addr(&bo->bo.vma_node); | |
53 | -#endif | |
54 | +#endif /* >= KERNEL_VERSION(5, 4, 0) */ | |
55 | } | |
56 | ||
57 | int | |
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 | |
61 | @@ -924,8 +924,13 @@ | |
62 | for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++) | |
63 | { | |
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); | |
75 | @@ -940,8 +945,13 @@ | |
76 | for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++) | |
77 | { | |
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 | |
92 | @@ -1052,7 +1052,7 @@ | |
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; | |
98 | } | |
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 | |
104 | @@ -443,9 +443,6 @@ | |
105 | } | |
106 | ||
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); | |
110 | -#endif | |
111 | } | |
112 | *pPhys = page_to_phys(paPages); | |
113 | pvRet = phys_to_virt(page_to_phys(paPages)); | |
114 | @@ -491,9 +488,6 @@ | |
115 | for (iPage = 0; iPage < cPages; iPage++) | |
116 | { | |
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); | |
120 | -#endif | |
121 | } | |
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 | |
127 | @@ -86,6 +86,8 @@ | |
128 | /** Set if the allocation is contiguous. | |
129 | * This means it has to be given back as one chunk. */ | |
130 | bool fContiguous; | |
131 | + /** Set if executable allocation. */ | |
132 | + bool fExecutable; | |
133 | /** Set if we've vmap'ed the memory into ring-0. */ | |
134 | bool fMappedToRing0; | |
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. | |
142 | */ | |
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) | |
146 | { | |
147 | size_t iPage; | |
148 | size_t const cPages = cb >> PAGE_SHIFT; | |
149 | @@ -371,7 +374,8 @@ | |
150 | for (iPage = 0; iPage < cPages; iPage++) | |
151 | { | |
152 | pMemLnx->apPages[iPage] = &paPages[iPage]; | |
153 | - MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1); | |
154 | + if (fExecutable) | |
155 | + MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1); | |
156 | if (PageHighMem(pMemLnx->apPages[iPage])) | |
157 | BUG(); | |
158 | } | |
159 | @@ -379,6 +383,7 @@ | |
160 | fContiguous = true; | |
161 | #endif /* < 2.4.22 */ | |
162 | pMemLnx->fContiguous = fContiguous; | |
163 | + pMemLnx->fExecutable = fExecutable; | |
164 | ||
165 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) | |
166 | /* | |
167 | @@ -409,7 +414,7 @@ | |
168 | * This should never happen! | |
169 | */ | |
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); | |
174 | return rcNoMem; | |
175 | } | |
176 | @@ -438,14 +443,12 @@ | |
177 | while (iPage-- > 0) | |
178 | { | |
179 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) | |
180 | - /* | |
181 | - * See SetPageReserved() in rtR0MemObjLinuxAllocPages() | |
182 | - */ | |
183 | + /* See SetPageReserved() in rtR0MemObjLinuxAllocPages() */ | |
184 | ClearPageReserved(pMemLnx->apPages[iPage]); | |
185 | #endif | |
186 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22) | |
187 | -#else | |
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); | |
192 | #endif | |
193 | } | |
194 | ||
195 | @@ -662,10 +665,10 @@ | |
196 | ||
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); | |
201 | #else | |
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); | |
205 | #endif | |
206 | if (RT_SUCCESS(rc)) | |
207 | { | |
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); | |
214 | if (RT_FAILURE(rc)) | |
215 | #endif | |
216 | #ifdef RT_ARCH_AMD64 | |
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); | |
221 | #else | |
222 | # ifdef CONFIG_X86_PAE | |
223 | # endif | |
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); | |
228 | #endif | |
229 | if (RT_SUCCESS(rc)) | |
230 | { | |
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); | |
237 | if (RT_FAILURE(rc)) | |
238 | #endif | |
239 | #ifdef RT_ARCH_AMD64 | |
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); | |
244 | #else | |
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); | |
249 | #endif | |
250 | if (RT_SUCCESS(rc)) | |
251 | { | |
252 | @@ -795,7 +798,7 @@ | |
253 | ||
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); | |
258 | if (RT_FAILURE(rc)) | |
259 | return rc; | |
260 | ||
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 | |
264 | @@ -337,8 +337,10 @@ | |
265 | #endif | |
266 | ||
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) | |
273 | +# endif | |
274 | #else | |
275 | # define MY_SET_PAGES_EXEC(pPages, cPages) \ | |
276 | do { \ | |
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 | |
280 | @@ -36,6 +36,9 @@ | |
281 | #include <iprt/errcore.h> | |
282 | #include "internal/thread.h" | |
283 | ||
284 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) | |
285 | + #include <uapi/linux/sched/types.h> | |
286 | +#endif /* >= KERNEL_VERSION(4, 11, 0) */ | |
287 | ||
288 | RTDECL(RTTHREAD) RTThreadSelf(void) | |
289 | { |