@@ -23,18 +23,6 @@ static bool lib_loaded;
23
23
bool linkernsbypass_load_status () {
24
24
return lib_loaded;
25
25
}
26
-
27
- struct android_namespace_t *android_create_namespace (const char *name,
28
- const char *ld_library_path,
29
- const char *default_library_path,
30
- uint64_t type,
31
- const char *permitted_when_isolated_path,
32
- android_namespace_t *parent_namespace) {
33
- auto caller{__builtin_return_address (0 )};
34
- return loader_android_create_namespace (name, ld_library_path, default_library_path, type,
35
- permitted_when_isolated_path, parent_namespace, caller);
36
- }
37
-
38
26
struct android_namespace_t *android_create_namespace_escape (const char *name,
39
27
const char *ld_library_path,
40
28
const char *default_library_path,
@@ -46,19 +34,6 @@ struct android_namespace_t *android_create_namespace_escape(const char *name,
46
34
permitted_when_isolated_path, parent_namespace, caller);
47
35
}
48
36
49
- android_get_exported_namespace_t android_get_exported_namespace;
50
-
51
- android_link_namespaces_all_libs_t android_link_namespaces_all_libs;
52
-
53
- android_link_namespaces_t android_link_namespaces;
54
-
55
- bool linkernsbypass_link_namespace_to_default_all_libs (android_namespace_t *to) {
56
- // Creating a shared namespace with the default parent will give a copy of the default namespace that we can actually access
57
- // This is needed since there is no way to access a direct handle to the default namespace as it's not exported
58
- static auto defaultNs{android_create_namespace_escape (" default_copy" , nullptr , nullptr , ANDROID_NAMESPACE_TYPE_SHARED, nullptr , nullptr )};
59
- return android_link_namespaces_all_libs (to, defaultNs);
60
- }
61
-
62
37
void *linkernsbypass_namespace_dlopen (const char *filename, int flags, android_namespace_t *ns) {
63
38
android_dlextinfo extInfo{
64
39
.flags = ANDROID_DLEXT_USE_NAMESPACE,
@@ -95,7 +70,7 @@ __attribute__((constructor)) static void resolve_linker_symbols() {
95
70
};
96
71
static_assert (sizeof (BranchLinked) == 4 , " BranchLinked is wrong size" );
97
72
98
- // Some devices ship with --X mapping for exexecutables so work around that
73
+ // Some devices ship with --X mapping for executables so work around that
99
74
mprotect (align_ptr (reinterpret_cast <void *>(&dlopen)), getpagesize (), PROT_WRITE | PROT_READ | PROT_EXEC);
100
75
101
76
// dlopen is just a wrapper for __loader_dlopen that passes the return address as the third arg hence we can just walk it to find __loader_dlopen
@@ -114,14 +89,6 @@ __attribute__((constructor)) static void resolve_linker_symbols() {
114
89
if (!ldHandle)
115
90
return ;
116
91
117
- android_link_namespaces_all_libs = reinterpret_cast <android_link_namespaces_all_libs_t >(dlsym (ldHandle, " __loader_android_link_namespaces_all_libs" ));
118
- if (!android_link_namespaces_all_libs)
119
- return ;
120
-
121
- android_link_namespaces = reinterpret_cast <android_link_namespaces_t >(dlsym (ldHandle, " __loader_android_link_namespaces" ));
122
- if (!android_link_namespaces)
123
- return ;
124
-
125
92
auto libdlAndroidHandle{loader_dlopen (" libdl_android.so" , RTLD_LAZY, reinterpret_cast <void *>(&dlopen))};
126
93
if (!libdlAndroidHandle)
127
94
return ;
@@ -130,10 +97,6 @@ __attribute__((constructor)) static void resolve_linker_symbols() {
130
97
if (!loader_android_create_namespace)
131
98
return ;
132
99
133
- android_get_exported_namespace = reinterpret_cast <android_get_exported_namespace_t >(dlsym (libdlAndroidHandle, " __loader_android_get_exported_namespace" ));
134
- if (!android_get_exported_namespace)
135
- return ;
136
-
137
100
// Lib is now safe to use
138
101
lib_loaded = true ;
139
102
}
0 commit comments