linker: Allow caller to specify parent namespace
This change enables apps to share libraries opened
with RTLD_GLOBAL between different classloader namespaces.
The new parameter to create_namespace allows native_loader
to instruct the linker to share libraries belonging to
global group from a specified namespace instead of
using the caller_ns.
Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I5d0c62730bbed19cdeb16c7559c74aa262a2475f
(cherry picked from commit fc2da53440383fe1026e0eb287d643b577c2707d)
diff --git a/linker/linker.h b/linker/linker.h
index 3e6fa88..3ea601f 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -495,8 +495,12 @@
};
bool init_namespaces(const char* public_ns_sonames, const char* anon_ns_library_path);
-android_namespace_t* create_namespace(const void* caller_addr, const char* name,
- const char* ld_library_path, const char* default_library_path,
- uint64_t type, const char* permitted_when_isolated_path);
+android_namespace_t* create_namespace(const void* caller_addr,
+ const char* name,
+ const char* ld_library_path,
+ const char* default_library_path,
+ uint64_t type,
+ const char* permitted_when_isolated_path,
+ android_namespace_t* parent_namespace);
#endif