Loading...
--- xnu/xnu-12377.101.15/libkern/c++/OSSymbol.cpp
+++ xnu/xnu-8796.121.2/libkern/c++/OSSymbol.cpp
@@ -48,6 +48,7 @@
#include <string.h>
static ZONE_DEFINE(OSSymbol_zone, "iokit.OSSymbol", sizeof(OSSymbol), ZC_NONE);
+static SMR_DEFINE(OSSymbol_smr);
static LCK_GRP_DECLARE(lock_group, "OSSymbolPool");
#pragma clang diagnostic push
@@ -105,10 +106,11 @@
}
SMRH_TRAITS_DEFINE_STR(hash_traits, OSSymbol, hashlink,
- .domain = &smr_iokit,
- .obj_hash = OSSymbol_obj_hash,
- .obj_equ = OSSymbol_obj_equ,
- .obj_try_get = OSSymbol_obj_try_get);
+ .domain = &OSSymbol_smr,
+ .obj_hash = OSSymbol_obj_hash,
+ .obj_equ = OSSymbol_obj_equ,
+ .obj_try_get = OSSymbol_obj_try_get,
+ );
mutable lck_mtx_t _mutex;
struct smr_hash _hash;
@@ -366,7 +368,7 @@
/* Make sure no readers can see stale pointers that we rewrote */
if (mustSync) {
- smr_iokit_synchronize();
+ smr_synchronize(&OSSymbol_smr);
}
}
@@ -400,7 +402,7 @@
void
OSSymbol::initialize()
{
- zone_enable_smr(OSSymbol_zone, &smr_iokit, &OSSymbol_smr_free);
+ zone_enable_smr(OSSymbol_zone, &OSSymbol_smr, &OSSymbol_smr_free);
new (OSSymbolPoolStorage) OSSymbolPool();
}
@@ -453,7 +455,7 @@
return symbol;
}
-#if defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) || defined(KERNEL_INTEGRITY_PV_CTRR)
+#if defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR)
/*
* Empirically, symbols which string is from the rorgn part of the
* kernel are asked about all the time.
@@ -465,7 +467,7 @@
* from baseline (~6k), but avoiding the string copies saves about 60k.
*/
permanent = rorgn_contains((vm_offset_t)cString, key.smrk_len + 1, false);
-#endif /* defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) || defined(KERNEL_INTEGRITY_PV_CTRR) */
+#endif /* defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) */
/*
* can't use OSString::initWithCString* because it calls
@@ -511,9 +513,9 @@
return symbol;
}
-#if defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) || defined(KERNEL_INTEGRITY_PV_CTRR)
+#if defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR)
permanent = rorgn_contains((vm_offset_t)cString, key.smrk_len + 1, false);
-#endif /* defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) || defined(KERNEL_INTEGRITY_PV_CTRR) */
+#endif /* defined(KERNEL_INTEGRITY_KTRR) || defined(KERNEL_INTEGRITY_CTRR) */
auto newSymb = OSMakeShared<OSSymbol>();