public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Lars Wendler" <polynomial-c@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/virtualbox-modules/, app-emulation/virtualbox-modules/files/
Date: Mon, 14 Dec 2020 10:56:23 +0000 (UTC)	[thread overview]
Message-ID: <1607943369.aa4ae7bff0fcd4972c8258a53e979976dd7a7afc.polynomial-c@gentoo> (raw)

commit:     aa4ae7bff0fcd4972c8258a53e979976dd7a7afc
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 14 10:56:09 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Dec 14 10:56:09 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa4ae7bf

app-emulation/virtualbox-modules: Fixed build with kernel-5.10

Thanks-to: jospezial <jospezial <AT> gmx.de>
Reported-by: Helmut Jarausch <jarausch <AT> igpm.rwth-aachen.de>
Closes: https://bugs.gentoo.org/751328
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 ...les-6.1.16-linux-5.10-r0drv-memobj-fix-r0.patch | 96 ++++++++++++++++++++++
 .../virtualbox-modules-6.1.16-r1.ebuild            |  4 +
 2 files changed, 100 insertions(+)

diff --git a/app-emulation/virtualbox-modules/files/virtualbox-modules-6.1.16-linux-5.10-r0drv-memobj-fix-r0.patch b/app-emulation/virtualbox-modules/files/virtualbox-modules-6.1.16-linux-5.10-r0drv-memobj-fix-r0.patch
new file mode 100644
index 00000000000..168d7c24f5a
--- /dev/null
+++ b/app-emulation/virtualbox-modules/files/virtualbox-modules-6.1.16-linux-5.10-r0drv-memobj-fix-r0.patch
@@ -0,0 +1,96 @@
+Index: vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+===================================================================
+--- a/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
++++ b/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,7 +505,43 @@
+ }
+ 
+ 
++#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.
+  *
+  * This will update the RTR0MEMOBJLNX::Core.pv and RTR0MEMOBJ::fMappedToRing0 members.
+@@ -584,6 +623,11 @@
+         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 @@
+         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/app-emulation/virtualbox-modules/virtualbox-modules-6.1.16-r1.ebuild b/app-emulation/virtualbox-modules/virtualbox-modules-6.1.16-r1.ebuild
index 29faf7632fd..28c26bd6c0c 100644
--- a/app-emulation/virtualbox-modules/virtualbox-modules-6.1.16-r1.ebuild
+++ b/app-emulation/virtualbox-modules/virtualbox-modules-6.1.16-r1.ebuild
@@ -29,6 +29,10 @@ MODULESD_VBOXDRV_ENABLED="yes"
 MODULESD_VBOXNETADP_ENABLED="no"
 MODULESD_VBOXNETFLT_ENABLED="no"
 
+PATCHES=(
+	"${FILESDIR}/${P}-linux-5.10-r0drv-memobj-fix-r0.patch" #751328
+)
+
 pkg_setup() {
 	linux-mod_pkg_setup
 	BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"


             reply	other threads:[~2020-12-14 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 10:56 Lars Wendler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-24  9:02 [gentoo-commits] repo/gentoo:master commit in: app-emulation/virtualbox-modules/, app-emulation/virtualbox-modules/files/ Viorel Munteanu
2023-08-14 15:29 Viorel Munteanu
2019-11-27 12:17 Lars Wendler
2018-02-16 13:12 Lars Wendler
2016-12-18 11:41 Justin Lecher
2016-07-14  9:28 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1607943369.aa4ae7bff0fcd4972c8258a53e979976dd7a7afc.polynomial-c@gentoo \
    --to=polynomial-c@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox