Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
@ 2020-12-18 13:58 pullmoll
  2020-12-18 15:44 ` pullmoll
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 13:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

There is a new pull request by pullmoll against master on the void-packages repository

https://github.com/pullmoll/void-packages virtualbox-ose-linux-5.10
https://github.com/void-linux/void-packages/pull/27256

virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/27256.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-virtualbox-ose-linux-5.10-27256.patch --]
[-- Type: text/x-diff, Size: 8438 bytes --]

From b60a1fded403d425845b64fc041e824eec00e1e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= <pullmoll@t-online.de>
Date: Fri, 18 Dec 2020 14:54:59 +0100
Subject: [PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check

Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]
---
 srcpkgs/virtualbox-ose/files/vboxservice/run  |  1 +
 .../018-linux-5.10-r0drv-memobj-fix.patch     | 97 +++++++++++++++++++
 .../019-linux-5.10-address-space-fixes.patch  | 17 ++++
 .../020-linux-5.10-framebuffer-fixes.patch    | 47 +++++++++
 srcpkgs/virtualbox-ose/template               |  2 +-
 5 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch

diff --git a/srcpkgs/virtualbox-ose/files/vboxservice/run b/srcpkgs/virtualbox-ose/files/vboxservice/run
index 6332cc9f13a..92311ba7ca1 100755
--- a/srcpkgs/virtualbox-ose/files/vboxservice/run
+++ b/srcpkgs/virtualbox-ose/files/vboxservice/run
@@ -1,2 +1,3 @@
 #!/bin/sh
+sv check dbus >/dev/null || exit 1
 exec VBoxService -f
diff --git a/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
new file mode 100644
index 00000000000..ae75c5cbe21
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
@@ -0,0 +1,97 @@
+:Index: src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+===================================================================
+--- src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Revision 141658)
++++ src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Arbeitskopie)
+@@ -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/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
new file mode 100644
index 00000000000..ffb704e4aa6
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
@@ -0,0 +1,17 @@
+Index: b/src/VBox/Additions/linux/sharedfolders/regops.c
+===================================================================
+--- src/VBox/Additions/linux/sharedfolders/regops.c
++++ src/VBox/Additions/linux/sharedfolders/regops.c
+@@ -1401,7 +1401,10 @@ static int vbsf_lock_user_pages_failed_c
+     /*
+      * Check that this is valid user memory that is actually in the kernel range.
+      */
+-#if RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
++#if RTLNX_VER_MIN(5,10,0)
++    if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
++        && uPtrFrom >= TASK_SIZE_MAX)
++#elif RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
+     if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
+         && uPtrFrom >= USER_DS.seg)
+ #else
+
diff --git a/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
new file mode 100644
index 00000000000..a1bbbd9c3dc
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
@@ -0,0 +1,47 @@
+Index: b/src/VBox/Additions/linux/drm/vbox_drv.h
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_drv.h
++++ src/VBox/Additions/linux/drm/vbox_drv.h
+@@ -205,6 +205,13 @@ static inline void drm_gem_object_put(st
+ }
+ #endif
+ 
++#ifndef TTM_PL_FLAG_SYSTEM
++#define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
++#endif
++#ifndef TTM_PL_FLAG_VRAM
++#define TTM_PL_FLAG_VRAM        (1 << TTM_PL_VRAM)
++#endif
++
+ #define DRIVER_AUTHOR       VBOX_VENDOR
+ 
+ #define DRIVER_NAME         "vboxvideo"
+Index: b/src/VBox/Additions/linux/drm/vbox_ttm.c
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_ttm.c
++++ src/VBox/Additions/linux/drm/vbox_ttm.c
+@@ -373,11 +373,23 @@ void vbox_ttm_placement(struct vbox_bo *
+ 	bo->placement.busy_placement = bo->placements;
+ 
+ 	if (domain & TTM_PL_FLAG_VRAM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_VRAM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
++#endif
+ 	if (domain & TTM_PL_FLAG_SYSTEM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_SYSTEM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_MASK_CACHING;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
++#endif
+ 	if (!c)
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+
diff --git a/srcpkgs/virtualbox-ose/template b/srcpkgs/virtualbox-ose/template
index 877c5da4ea0..ff728d6ce40 100644
--- a/srcpkgs/virtualbox-ose/template
+++ b/srcpkgs/virtualbox-ose/template
@@ -1,7 +1,7 @@
 # Template file for 'virtualbox-ose'
 pkgname=virtualbox-ose
 version=6.1.16
-revision=1
+revision=2
 wrksrc="VirtualBox-${version}"
 short_desc="General-purpose full virtualizer for x86 hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
@ 2020-12-18 15:44 ` pullmoll
  2020-12-18 15:47 ` ericonr
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/27256#issuecomment-748165398

Comment:
Ok, now tested on another machine which I upgraded to linux-5.10.1.There I created a Void Linux VM and installed the XFCE ISO, updated system etc. Seems to be working at least for Void as guest.

Any objections for the `dbus` check? Otherwise I'd merge this.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
  2020-12-18 15:44 ` pullmoll
@ 2020-12-18 15:47 ` ericonr
  2020-12-18 15:48 ` pullmoll
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ericonr @ 2020-12-18 15:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/27256#issuecomment-748166937

Comment:
What information does the D-Bus check add? From what I understand, the service already dies by itself if D-Bus isn't available...

Maybe a comment that it requires D-Bus would achieve the same purpose.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
  2020-12-18 15:44 ` pullmoll
  2020-12-18 15:47 ` ericonr
@ 2020-12-18 15:48 ` pullmoll
  2020-12-18 15:49 ` pullmoll
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/27256#issuecomment-748167426

Comment:
Well, I don't care and saw no comment on the original PR. I can just remove it if you think it's redundant.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
                   ` (2 preceding siblings ...)
  2020-12-18 15:48 ` pullmoll
@ 2020-12-18 15:49 ` pullmoll
  2020-12-18 15:49 ` pullmoll
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/27256#issuecomment-748167426

Comment:
Well, I don't care and saw no comment on the original PR. I can just remove it if you think it's redundant.
Or write a line
```
# Note: requires dbus service
```

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
                   ` (3 preceding siblings ...)
  2020-12-18 15:49 ` pullmoll
@ 2020-12-18 15:49 ` pullmoll
  2020-12-18 15:52 ` [PR PATCH] [Updated] " pullmoll
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/27256#issuecomment-748167426

Comment:
Well, I don't care and saw no comment on the original PR. I can just remove it if you think it's redundant.
Or write a line
```
# Note: requires dbus service
```
in the `.../run` file.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PR PATCH] [Updated] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
                   ` (4 preceding siblings ...)
  2020-12-18 15:49 ` pullmoll
@ 2020-12-18 15:52 ` pullmoll
  2020-12-18 15:56 ` pullmoll
  2020-12-18 16:22 ` [PR PATCH] [Merged]: virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint pullmoll
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

There is an updated pull request by pullmoll against master on the void-packages repository

https://github.com/pullmoll/void-packages virtualbox-ose-linux-5.10
https://github.com/void-linux/void-packages/pull/27256

virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]

https://www.virtualbox.org/ticket/20055
DKMS builds but is not yet tested because I can't currently boot into 5.10. Anyone?


A patch file from https://github.com/void-linux/void-packages/pull/27256.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-virtualbox-ose-linux-5.10-27256.patch --]
[-- Type: text/x-diff, Size: 8433 bytes --]

From d04b0c93320f4e09c837c160a278bf7af5ef2e50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= <pullmoll@t-online.de>
Date: Fri, 18 Dec 2020 14:54:59 +0100
Subject: [PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check

Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]
---
 srcpkgs/virtualbox-ose/files/vboxservice/run  |  1 +
 .../018-linux-5.10-r0drv-memobj-fix.patch     | 97 +++++++++++++++++++
 .../019-linux-5.10-address-space-fixes.patch  | 17 ++++
 .../020-linux-5.10-framebuffer-fixes.patch    | 47 +++++++++
 srcpkgs/virtualbox-ose/template               |  2 +-
 5 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch

diff --git a/srcpkgs/virtualbox-ose/files/vboxservice/run b/srcpkgs/virtualbox-ose/files/vboxservice/run
index 6332cc9f13a..c3c0d94d034 100755
--- a/srcpkgs/virtualbox-ose/files/vboxservice/run
+++ b/srcpkgs/virtualbox-ose/files/vboxservice/run
@@ -1,2 +1,3 @@
 #!/bin/sh
+# Note: requires dbus service
 exec VBoxService -f
diff --git a/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
new file mode 100644
index 00000000000..ae75c5cbe21
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
@@ -0,0 +1,97 @@
+:Index: src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+===================================================================
+--- src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Revision 141658)
++++ src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Arbeitskopie)
+@@ -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/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
new file mode 100644
index 00000000000..ffb704e4aa6
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
@@ -0,0 +1,17 @@
+Index: b/src/VBox/Additions/linux/sharedfolders/regops.c
+===================================================================
+--- src/VBox/Additions/linux/sharedfolders/regops.c
++++ src/VBox/Additions/linux/sharedfolders/regops.c
+@@ -1401,7 +1401,10 @@ static int vbsf_lock_user_pages_failed_c
+     /*
+      * Check that this is valid user memory that is actually in the kernel range.
+      */
+-#if RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
++#if RTLNX_VER_MIN(5,10,0)
++    if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
++        && uPtrFrom >= TASK_SIZE_MAX)
++#elif RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
+     if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
+         && uPtrFrom >= USER_DS.seg)
+ #else
+
diff --git a/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
new file mode 100644
index 00000000000..a1bbbd9c3dc
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
@@ -0,0 +1,47 @@
+Index: b/src/VBox/Additions/linux/drm/vbox_drv.h
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_drv.h
++++ src/VBox/Additions/linux/drm/vbox_drv.h
+@@ -205,6 +205,13 @@ static inline void drm_gem_object_put(st
+ }
+ #endif
+ 
++#ifndef TTM_PL_FLAG_SYSTEM
++#define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
++#endif
++#ifndef TTM_PL_FLAG_VRAM
++#define TTM_PL_FLAG_VRAM        (1 << TTM_PL_VRAM)
++#endif
++
+ #define DRIVER_AUTHOR       VBOX_VENDOR
+ 
+ #define DRIVER_NAME         "vboxvideo"
+Index: b/src/VBox/Additions/linux/drm/vbox_ttm.c
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_ttm.c
++++ src/VBox/Additions/linux/drm/vbox_ttm.c
+@@ -373,11 +373,23 @@ void vbox_ttm_placement(struct vbox_bo *
+ 	bo->placement.busy_placement = bo->placements;
+ 
+ 	if (domain & TTM_PL_FLAG_VRAM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_VRAM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
++#endif
+ 	if (domain & TTM_PL_FLAG_SYSTEM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_SYSTEM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_MASK_CACHING;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
++#endif
+ 	if (!c)
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+
diff --git a/srcpkgs/virtualbox-ose/template b/srcpkgs/virtualbox-ose/template
index 877c5da4ea0..ff728d6ce40 100644
--- a/srcpkgs/virtualbox-ose/template
+++ b/srcpkgs/virtualbox-ose/template
@@ -1,7 +1,7 @@
 # Template file for 'virtualbox-ose'
 pkgname=virtualbox-ose
 version=6.1.16
-revision=1
+revision=2
 wrksrc="VirtualBox-${version}"
 short_desc="General-purpose full virtualizer for x86 hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PR PATCH] [Updated] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
                   ` (5 preceding siblings ...)
  2020-12-18 15:52 ` [PR PATCH] [Updated] " pullmoll
@ 2020-12-18 15:56 ` pullmoll
  2020-12-18 16:22 ` [PR PATCH] [Merged]: virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint pullmoll
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 15:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

There is an updated pull request by pullmoll against master on the void-packages repository

https://github.com/pullmoll/void-packages virtualbox-ose-linux-5.10
https://github.com/void-linux/void-packages/pull/27256

virtualbox-ose: fix DKMS w/ linux-5.10; dbus check
Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]

https://www.virtualbox.org/ticket/20055
DKMS builds but is not yet tested because I can't currently boot into 5.10. Anyone?


A patch file from https://github.com/void-linux/void-packages/pull/27256.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-virtualbox-ose-linux-5.10-27256.patch --]
[-- Type: text/x-diff, Size: 8433 bytes --]

From 29f645ee7ac719b0d03a06c7110c2124cb9b751c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= <pullmoll@t-online.de>
Date: Fri, 18 Dec 2020 14:54:59 +0100
Subject: [PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint

Fix DKMS with linux-5.10 and add a hint for dbus requirement.

Closes: #25277

[ci skip]
---
 srcpkgs/virtualbox-ose/files/vboxservice/run  |  1 +
 .../018-linux-5.10-r0drv-memobj-fix.patch     | 97 +++++++++++++++++++
 .../019-linux-5.10-address-space-fixes.patch  | 17 ++++
 .../020-linux-5.10-framebuffer-fixes.patch    | 47 +++++++++
 srcpkgs/virtualbox-ose/template               |  2 +-
 5 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
 create mode 100644 srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch

diff --git a/srcpkgs/virtualbox-ose/files/vboxservice/run b/srcpkgs/virtualbox-ose/files/vboxservice/run
index 6332cc9f13a..c3c0d94d034 100755
--- a/srcpkgs/virtualbox-ose/files/vboxservice/run
+++ b/srcpkgs/virtualbox-ose/files/vboxservice/run
@@ -1,2 +1,3 @@
 #!/bin/sh
+# Note: requires dbus service
 exec VBoxService -f
diff --git a/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
new file mode 100644
index 00000000000..ae75c5cbe21
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/018-linux-5.10-r0drv-memobj-fix.patch
@@ -0,0 +1,97 @@
+:Index: src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+===================================================================
+--- src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Revision 141658)
++++ src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(Arbeitskopie)
+@@ -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/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
new file mode 100644
index 00000000000..ffb704e4aa6
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/019-linux-5.10-address-space-fixes.patch
@@ -0,0 +1,17 @@
+Index: b/src/VBox/Additions/linux/sharedfolders/regops.c
+===================================================================
+--- src/VBox/Additions/linux/sharedfolders/regops.c
++++ src/VBox/Additions/linux/sharedfolders/regops.c
+@@ -1401,7 +1401,10 @@ static int vbsf_lock_user_pages_failed_c
+     /*
+      * Check that this is valid user memory that is actually in the kernel range.
+      */
+-#if RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
++#if RTLNX_VER_MIN(5,10,0)
++    if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
++        && uPtrFrom >= TASK_SIZE_MAX)
++#elif RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,1)
+     if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
+         && uPtrFrom >= USER_DS.seg)
+ #else
+
diff --git a/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
new file mode 100644
index 00000000000..a1bbbd9c3dc
--- /dev/null
+++ b/srcpkgs/virtualbox-ose/patches/020-linux-5.10-framebuffer-fixes.patch
@@ -0,0 +1,47 @@
+Index: b/src/VBox/Additions/linux/drm/vbox_drv.h
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_drv.h
++++ src/VBox/Additions/linux/drm/vbox_drv.h
+@@ -205,6 +205,13 @@ static inline void drm_gem_object_put(st
+ }
+ #endif
+ 
++#ifndef TTM_PL_FLAG_SYSTEM
++#define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
++#endif
++#ifndef TTM_PL_FLAG_VRAM
++#define TTM_PL_FLAG_VRAM        (1 << TTM_PL_VRAM)
++#endif
++
+ #define DRIVER_AUTHOR       VBOX_VENDOR
+ 
+ #define DRIVER_NAME         "vboxvideo"
+Index: b/src/VBox/Additions/linux/drm/vbox_ttm.c
+===================================================================
+--- src/VBox/Additions/linux/drm/vbox_ttm.c
++++ src/VBox/Additions/linux/drm/vbox_ttm.c
+@@ -373,11 +373,23 @@ void vbox_ttm_placement(struct vbox_bo *
+ 	bo->placement.busy_placement = bo->placements;
+ 
+ 	if (domain & TTM_PL_FLAG_VRAM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_VRAM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
++#endif
+ 	if (domain & TTM_PL_FLAG_SYSTEM)
++#if RTLNX_VER_MIN(5,10,0)
++		bo->placements[c].mem_type = TTM_PL_SYSTEM;
++		PLACEMENT_FLAGS(bo->placements[c++]) =
++		    TTM_PL_MASK_CACHING;
++#else
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
++#endif
+ 	if (!c)
+ 		PLACEMENT_FLAGS(bo->placements[c++]) =
+ 		    TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+
diff --git a/srcpkgs/virtualbox-ose/template b/srcpkgs/virtualbox-ose/template
index 877c5da4ea0..ff728d6ce40 100644
--- a/srcpkgs/virtualbox-ose/template
+++ b/srcpkgs/virtualbox-ose/template
@@ -1,7 +1,7 @@
 # Template file for 'virtualbox-ose'
 pkgname=virtualbox-ose
 version=6.1.16
-revision=1
+revision=2
 wrksrc="VirtualBox-${version}"
 short_desc="General-purpose full virtualizer for x86 hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PR PATCH] [Merged]: virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint
  2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
                   ` (6 preceding siblings ...)
  2020-12-18 15:56 ` pullmoll
@ 2020-12-18 16:22 ` pullmoll
  7 siblings, 0 replies; 9+ messages in thread
From: pullmoll @ 2020-12-18 16:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

There's a merged pull request on the void-packages repository

virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint
https://github.com/void-linux/void-packages/pull/27256

Description:
Fix DKMS with linux-5.10 and add check for dbus from #25277.

Closes: #25277

[ci skip]

https://www.virtualbox.org/ticket/20055
DKMS builds but is not yet tested because I can't currently boot into 5.10. Anyone?


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-18 16:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 13:58 [PR PATCH] virtualbox-ose: fix DKMS w/ linux-5.10; dbus check pullmoll
2020-12-18 15:44 ` pullmoll
2020-12-18 15:47 ` ericonr
2020-12-18 15:48 ` pullmoll
2020-12-18 15:49 ` pullmoll
2020-12-18 15:49 ` pullmoll
2020-12-18 15:52 ` [PR PATCH] [Updated] " pullmoll
2020-12-18 15:56 ` pullmoll
2020-12-18 16:22 ` [PR PATCH] [Merged]: virtualbox-ose: fix DKMS w/ linux-5.10; dbus hint pullmoll

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).