From deac29c576ff1ec5f8aea64082d54f1070ab4262 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sun, 13 Mar 2022 14:10:28 +0000 Subject: [PATCH] CheriBSD renamed VMEM SW perm bit CheriBSD 00d71bd4d11af448871d196f987c2ded474f3039 changes "CHERI_PERM_CHERIABI_VMMAP" to be spelled "CHERI_PERM_SW_VMEM" and deprecated the old form. Follow along with fallback so we can use older CheriBSDs. --- src/pal/pal_freebsd.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pal/pal_freebsd.h b/src/pal/pal_freebsd.h index 66ef925..916fc70 100644 --- a/src/pal/pal_freebsd.h +++ b/src/pal/pal_freebsd.h @@ -3,11 +3,14 @@ #if defined(__FreeBSD__) && !defined(_KERNEL) # include "pal_bsd_aligned.h" -// On CHERI platforms, we need to know the value of CHERI_PERM_CHERIABI_VMMAP. +// On CHERI platforms, we need to know the value of CHERI_PERM_SW_VMEM. // This pollutes the global namespace a little, sadly, but I think only with // symbols that begin with CHERI_, which is as close to namespaces as C offers. # if defined(__CHERI_PURE_CAPABILITY__) # include +# if !defined(CHERI_PERM_SW_VMEM) +# define CHERI_PERM_SW_VMEM CHERI_PERM_CHERIABI_VMMAP +# endif # endif namespace snmalloc @@ -108,7 +111,7 @@ namespace snmalloc /** * On CheriBSD, exporting a pointer means stripping it of the authority to - * manage the address space it references by clearing the CHERIABI_VMMAP + * manage the address space it references by clearing the SW_VMEM * permission bit. */ template @@ -124,8 +127,7 @@ namespace snmalloc } return CapPtr>( __builtin_cheri_perms_and( - p.unsafe_ptr(), - ~static_cast(CHERI_PERM_CHERIABI_VMMAP))); + p.unsafe_ptr(), ~static_cast(CHERI_PERM_SW_VMEM))); } # endif };