summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO4
-rw-r--r--020-linux-5.10.patch93
-rw-r--r--PKGBUILD9
3 files changed, 102 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index abea1a3b9f2e..21f85f50a90a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = virtualbox-bin
pkgdesc = Powerful x86 virtualization for enterprise as well as home use (Oracle branded non-OSE)
pkgver = 6.1.16
- pkgrel = 1
+ pkgrel = 2
url = https://www.virtualbox.org/
arch = x86_64
license = GPL2
@@ -19,6 +19,7 @@ pkgbase = virtualbox-bin
source = virtualbox.sysusers
source = LICENSE.sdk
source = 013-Makefile.patch
+ source = 020-linux-5.10.patch
sha256sums = 35406e85a96ecf180b13145614230bae6c171e31a1f66263bf4c2b74bf6709e6
sha256sums = 0dc5a55fbf40e5120008a4148df1e9312bf0aa974cfb96f49e2947e20d408d47
sha256sums = 61eab70173ec0c4959ec3b8bf9fa19cfac49bb223a0bb041fe12aa14742db15a
@@ -31,6 +32,7 @@ pkgbase = virtualbox-bin
sha256sums = 2101ebb58233bbfadf3aa74381f22f7e7e508559d2b46387114bc2d8e308554c
sha256sums = 09335d7d1075df02d29cec13119538134efdf43ea73a93b0f89d0d7d4b6625a1
sha256sums = 3c2089575e8c03b7517fe176e65168e15fb7aefe7e71224bf264d21812dbc635
+ sha256sums = 5cbe28efb3ad6538e94bf5a40fe5be65a9f0e979ba67d9d8440817a2a259dd91
pkgname = virtualbox-bin
depends = device-mapper
diff --git a/020-linux-5.10.patch b/020-linux-5.10.patch
new file mode 100644
index 000000000000..f56615c1773f
--- /dev/null
+++ b/020-linux-5.10.patch
@@ -0,0 +1,93 @@
+--- a/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
++++ b/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+@@ -56,9 +56,12 @@
+ * Whether we use alloc_vm_area (3.2+) for executable memory.
+ * This is a must for 5.8+, but we enable it all the way back to 3.2.x for
+ * better W^R compliance (fExecutable flag). */
+-#if RTLNX_VER_MIN(3,2,0) || defined(DOXYGEN_RUNNING)
++#if RTLNX_VER_RANGE(3,2,0, 5,10,0) || defined(DOXYGEN_RUNNING)
+ # define IPRT_USE_ALLOC_VM_AREA_FOR_EXEC
+ #endif
++#if RTLNX_VER_MIN(5,10,0) || defined(DOXYGEN_RUNNING)
++# define IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC
++#endif
+
+ /*
+ * 2.6.29+ kernels don't work with remap_pfn_range() anymore because
+@@ -502,6 +505,42 @@ static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx)
+ }
+
+
++#ifdef IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC
++/**
++ * User data passed to the apply_to_page_range() callback.
++ */
++typedef struct LNXAPPLYPGRANGE
++{
++ /** Pointer to the memory object. */
++ PRTR0MEMOBJLNX pMemLnx;
++ /** The page protection flags to apply. */
++ pgprot_t fPg;
++} LNXAPPLYPGRANGE;
++/** Pointer to the user data. */
++typedef LNXAPPLYPGRANGE *PLNXAPPLYPGRANGE;
++/** Pointer to the const user data. */
++typedef const LNXAPPLYPGRANGE *PCLNXAPPLYPGRANGE;
++
++/**
++ * Callback called in apply_to_page_range().
++ *
++ * @returns Linux status code.
++ * @param pPte Pointer to the page table entry for the given address.
++ * @param uAddr The address to apply the new protection to.
++ * @param pvUser The opaque user data.
++ */
++static DECLCALLBACK(int) rtR0MemObjLinuxApplyPageRange(pte_t *pPte, unsigned long uAddr, void *pvUser)
++{
++ PCLNXAPPLYPGRANGE pArgs = (PCLNXAPPLYPGRANGE)pvUser;
++ PRTR0MEMOBJLNX pMemLnx = pArgs->pMemLnx;
++ uint32_t idxPg = (uAddr - (unsigned long)pMemLnx->Core.pv) >> PAGE_SHIFT;
++
++ set_pte(pPte, mk_pte(pMemLnx->apPages[idxPg], pArgs->fPg));
++ return 0;
++}
++#endif
++
++
+ /**
+ * Maps the allocation into ring-0.
+ *
+@@ -584,6 +623,11 @@ static int rtR0MemObjLinuxVMap(PRTR0MEMOBJLNX pMemLnx, bool fExecutable)
+ else
+ # endif
+ {
++# if defined(IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC)
++ if (fExecutable)
++ pgprot_val(fPg) |= _PAGE_NX; /* Uses RTR0MemObjProtect to clear NX when memory ready, W^X fashion. */
++# endif
++
+ # ifdef VM_MAP
+ pMemLnx->Core.pv = vmap(&pMemLnx->apPages[0], pMemLnx->cPages, VM_MAP, fPg);
+ # else
+@@ -1851,6 +1895,21 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub,
+ preempt_enable();
+ return VINF_SUCCESS;
+ }
++# elif defined(IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC)
++ PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
++ if ( pMemLnx->fExecutable
++ && pMemLnx->fMappedToRing0)
++ {
++ LNXAPPLYPGRANGE Args;
++ Args.pMemLnx = pMemLnx;
++ Args.fPg = rtR0MemObjLinuxConvertProt(fProt, true /*fKernel*/);
++ int rcLnx = apply_to_page_range(current->active_mm, (unsigned long)pMemLnx->Core.pv + offSub, cbSub,
++ rtR0MemObjLinuxApplyPageRange, (void *)&Args);
++ if (rcLnx)
++ return VERR_NOT_SUPPORTED;
++
++ return VINF_SUCCESS;
++ }
+ # endif
+
+ NOREF(pMem);
diff --git a/PKGBUILD b/PKGBUILD
index e00cd715b2d8..674cf4eca6f2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,7 @@ pkgname=('virtualbox-bin' 'virtualbox-bin-guest-iso' 'virtualbox-bin-sdk')
pkgver=6.1.16
_build=140961
_rev=83509
-pkgrel=1
+pkgrel=2
pkgdesc='Powerful x86 virtualization for enterprise as well as home use (Oracle branded non-OSE)'
arch=('x86_64')
url='https://www.virtualbox.org/'
@@ -27,7 +27,8 @@ source=("http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver
'vboxweb.service'
'virtualbox.sysusers'
'LICENSE.sdk'
- '013-Makefile.patch')
+ '013-Makefile.patch'
+ '020-linux-5.10.patch')
noextract=("VirtualBoxSDK-${pkgver}-${_build}.zip")
sha256sums=('35406e85a96ecf180b13145614230bae6c171e31a1f66263bf4c2b74bf6709e6'
'0dc5a55fbf40e5120008a4148df1e9312bf0aa974cfb96f49e2947e20d408d47'
@@ -40,7 +41,8 @@ sha256sums=('35406e85a96ecf180b13145614230bae6c171e31a1f66263bf4c2b74bf6709e6'
'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f'
'2101ebb58233bbfadf3aa74381f22f7e7e508559d2b46387114bc2d8e308554c'
'09335d7d1075df02d29cec13119538134efdf43ea73a93b0f89d0d7d4b6625a1'
- '3c2089575e8c03b7517fe176e65168e15fb7aefe7e71224bf264d21812dbc635')
+ '3c2089575e8c03b7517fe176e65168e15fb7aefe7e71224bf264d21812dbc635'
+ '5cbe28efb3ad6538e94bf5a40fe5be65a9f0e979ba67d9d8440817a2a259dd91')
prepare() {
local _extractdir="${pkgname}-${pkgver}/VirtualBox-extracted"
@@ -58,6 +60,7 @@ prepare() {
# fix dkms build
patch -d "$_extractdir" -Np1 -i "${srcdir}/013-Makefile.patch"
+ patch -d "$_extractdir" -Np1 -i "${srcdir}/020-linux-5.10.patch"
}
build() {