@@ -46,29 +46,6 @@ using namespace reflection;
46
46
#include < objc/objc.h>
47
47
#endif
48
48
49
- #if __has_include(<mach-o/dyld_priv.h>)
50
- #include < mach-o/dyld_priv.h>
51
- #define SWIFT_HAS_DYLD_IS_MEMORY_IMMUTABLE
52
- #endif
53
-
54
- // / If the target platform has an API for asking whether an address is mapped
55
- // / from immutable pages of an executable image, this returns true if the
56
- // / given address is *not* from an executable image. Otherwise, this always
57
- // / returns false. The intent is to check that this returns false as a defense
58
- // / for APIs that expect to operate on immutable memory to prevent them from
59
- // / being fed untrusted data by an attacker, when the platform makes that
60
- // / possible.
61
- static bool isKnownToBeInMutableMemory (const void *base, size_t size) {
62
- #if defined(SWIFT_HAS_DYLD_IS_MEMORY_IMMUTABLE)
63
- if (__builtin_available (macOS 10.12 , iOS 10.0 , tvOS 10.0 , watchOS 3.0 , *))
64
- return !_dyld_is_memory_immutable (base, size);
65
- else
66
- return false ;
67
- #else
68
- return false ;
69
- #endif
70
- }
71
-
72
49
// / Produce a Demangler value suitable for resolving runtime type metadata
73
50
// / strings.
74
51
static Demangler getDemanglerForRuntimeTypeResolution () {
@@ -78,14 +55,8 @@ static Demangler getDemanglerForRuntimeTypeResolution() {
78
55
// mangled name we can immediately find the associated metadata.
79
56
dem.setSymbolicReferenceResolver ([&](int32_t offset,
80
57
const void *base) -> NodePointer {
81
- // Only read symbolic references out of constant memory.
82
- if (isKnownToBeInMutableMemory (base, sizeof (int )))
83
- return nullptr ;
84
-
85
- auto absolute_addr = detail::applyRelativeOffset (base, offset);
86
-
87
- auto reference = dem.createNode (Node::Kind::SymbolicReference,
88
- (uintptr_t )absolute_addr);
58
+ auto absolute_addr = (uintptr_t )detail::applyRelativeOffset (base, offset);
59
+ auto reference = dem.createNode (Node::Kind::SymbolicReference, absolute_addr);
89
60
auto type = dem.createNode (Node::Kind::Type);
90
61
type->addChild (reference, dem);
91
62
return type;
0 commit comments