Hi,

the following commit broke several virtualbox ports:

commit 0659df6faddfb27ba54a2cae2a12552cf4f823a0
Author: Konstantin Belousov <k...@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
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;

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to