[PATCH] Fix virtualbox-ose and virtualbox-ose-kmod ports

Stefan Esser se at freebsd.org
Sat Jan 16 17:34:04 UTC 2021


Hi,

the following commit broke several virtualbox ports:

commit 0659df6faddfb27ba54a2cae2a12552cf4f823a0
Author: Konstantin Belousov <kib at FreeBSD.org>
Date:   Tue Jan 12 14:43:39 2021 +0200

     vm_map_protect: allow to set prot and max_prot in one go.

     This prevents a situation where other thread modifies map entries
     permissions between setting max_prot, then relocking, then setting 
prot,
     confusing the operation outcome.  E.g. you can get an error that is not
     possible if operation is performed atomic.

     Also enable setting rwx for max_prot even if map does not allow to set
     effective rwx protection.

     Reviewed by:    brooks, markj (previous version)
     Sponsored by:   The FreeBSD Foundation
     Differential Revision:  https://reviews.freebsd.org/D28117


A simple patch is applied, but it does not take the kernel version
into account (-CURRENT before the function signature has been changed
and -STABLE).

Seems that __FreeBSD_version has been bumped to 1300135 less than
2 hours before 0659df6faddfb27ba54a2cae2a12552cf4f823a0 and thus
the patch could be made to depend on that __FreeBSD_version value.

Regards, STefan
-------------- next part --------------
Index: files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c
===================================================================
--- files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c	(revision 561738)
+++ files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c	(working copy)
@@ -421,7 +421,8 @@
 @@ -826,6 +885,7 @@ DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINT
          ProtectionFlags |= VM_PROT_EXECUTE;
  
-     int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, FALSE);
+-    int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, FALSE);
++    int krc = vm_map_protect(pVmMap, AddrStart, AddrEnd, ProtectionFlags, 0, VM_MAP_PROTECT_SET_PROT);
 +    IPRT_FREEBSD_RESTORE_EFL_AC();
      if (krc == KERN_SUCCESS)
          return VINF_SUCCESS;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20210116/21538ef6/attachment.sig>


More information about the freebsd-emulation mailing list