You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-emulation/virtualbox-modules/files/virtualbox-modules-6.0.14-k...

309 lines
13 KiB

https://www.virtualbox.org/changeset/81586/vbox
https://www.virtualbox.org/changeset/81587/vbox
https://www.virtualbox.org/changeset/81649/vbox (partially)
--- 6.0.14/vboxdrv/include/iprt/cdefs.h
+++ 6.0.14/vboxdrv/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
+++ 6.0.14/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
@@ -443,9 +443,6 @@
}
SetPageReserved(&paPages[iPage]);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
- MY_SET_PAGES_EXEC(&paPages[iPage], 1);
-#endif
}
*pPhys = page_to_phys(paPages);
pvRet = phys_to_virt(page_to_phys(paPages));
@@ -491,9 +488,6 @@
for (iPage = 0; iPage < cPages; iPage++)
{
ClearPageReserved(&paPages[iPage]);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
- MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
-#endif
}
__free_pages(paPages, cOrder);
IPRT_LINUX_RESTORE_EFL_AC();
--- 6.0.14/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+++ 6.0.14/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
@@ -86,6 +86,8 @@
/** Set if the allocation is contiguous.
* This means it has to be given back as one chunk. */
bool fContiguous;
+ /** Set if executable allocation. */
+ bool fExecutable;
/** Set if we've vmap'ed the memory into ring-0. */
bool fMappedToRing0;
/** The pages in the apPages array. */
@@ -289,10 +291,11 @@
* Only valid if fContiguous == true, ignored otherwise.
* @param fFlagsLnx The page allocation flags (GPFs).
* @param fContiguous Whether the allocation must be contiguous.
+ * @param fExecutable Whether the memory must be executable.
* @param rcNoMem What to return when we're out of pages.
*/
static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb,
- size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, int rcNoMem)
+ size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, bool fExecutable, int rcNoMem)
{
size_t iPage;
size_t const cPages = cb >> PAGE_SHIFT;
@@ -371,7 +374,8 @@
for (iPage = 0; iPage < cPages; iPage++)
{
pMemLnx->apPages[iPage] = &paPages[iPage];
- MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
+ if (fExecutable)
+ MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
if (PageHighMem(pMemLnx->apPages[iPage]))
BUG();
}
@@ -379,6 +383,7 @@
fContiguous = true;
#endif /* < 2.4.22 */
pMemLnx->fContiguous = fContiguous;
+ pMemLnx->fExecutable = fExecutable;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
/*
@@ -409,7 +414,7 @@
* This should never happen!
*/
printk("rtR0MemObjLinuxAllocPages(cb=0x%lx, uAlignment=0x%lx): alloc_pages(..., %d) returned physical memory at 0x%lx!\n",
- (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
+ (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
rtR0MemObjLinuxFreePages(pMemLnx);
return rcNoMem;
}
@@ -438,14 +443,12 @@
while (iPage-- > 0)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
- /*
- * See SetPageReserved() in rtR0MemObjLinuxAllocPages()
- */
+ /* See SetPageReserved() in rtR0MemObjLinuxAllocPages() */
ClearPageReserved(pMemLnx->apPages[iPage]);
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
-#else
- MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 22)
+ if (pMemLnx->fExecutable)
+ MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
#endif
}
@@ -662,10 +665,10 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER,
- false /* non-contiguous */, VERR_NO_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
#else
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER,
- false /* non-contiguous */, VERR_NO_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -696,19 +699,19 @@
#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
/* ZONE_DMA32: 0-4GB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
if (RT_FAILURE(rc))
#endif
#ifdef RT_ARCH_AMD64
/* ZONE_DMA: 0-16MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
#else
# ifdef CONFIG_X86_PAE
# endif
/* ZONE_NORMAL: 0-896MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -738,17 +741,17 @@
#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
/* ZONE_DMA32: 0-4GB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
if (RT_FAILURE(rc))
#endif
#ifdef RT_ARCH_AMD64
/* ZONE_DMA: 0-16MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
#else
/* ZONE_NORMAL (32-bit hosts): 0-896MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -795,7 +798,7 @@
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp,
enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */,
- VERR_NO_PHYS_MEMORY);
+ false /*fExecutable*/, VERR_NO_PHYS_MEMORY);
if (RT_FAILURE(rc))
return rc;
--- 6.0.14/vboxdrv/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxdrv/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# 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. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
+++ 6.0.14/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(4, 11, 0)
+ #include <uapi/linux/sched/types.h>
+#endif /* >= KERNEL_VERSION(4, 11, 0) */
RTDECL(RTTHREAD) RTThreadSelf(void)
{
--- 6.0.14/vboxnetadp/include/iprt/cdefs.h
+++ 6.0.14/vboxnetadp/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxnetadp/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxnetadp/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# 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. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxnetflt/include/iprt/cdefs.h
+++ 6.0.14/vboxnetflt/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxnetflt/linux/VBoxNetFlt-linux.c
+++ 6.0.14/vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -924,8 +924,13 @@
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 /* < KERNEL_VERSION(5, 4, 0) */
pSG->aSegs[iSeg].cb = pFrag->size;
pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
Log6((" %p", pSG->aSegs[iSeg].pv));
pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
Assert(iSeg <= pSG->cSegsAlloc);
@@ -940,8 +945,13 @@
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 /* < KERNEL_VERSION(5, 4, 0) */
pSG->aSegs[iSeg].cb = pFrag->size;
pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
Log6((" %p", pSG->aSegs[iSeg].pv));
pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
Assert(iSeg <= pSG->cSegsAlloc);
--- 6.0.14/vboxnetflt/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxnetflt/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# 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. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxpci/include/iprt/cdefs.h
+++ 6.0.14/vboxpci/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxpci/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxpci/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# 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. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \