linker: hide the pointer to soinfo
Handle no longer is a pointer to soinfo of
a corresponding library. This is done to
prevent access to linker internal fields.
Bug: http://b/25593965
Change-Id: I62bff0d0e5b2dc842e6bf0babb30fcc4c000be24
diff --git a/linker/linker.h b/linker/linker.h
index 9145454..81f93ac 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -268,6 +268,7 @@
public:
soinfo(android_namespace_t* ns, const char* name, const struct stat* file_stat,
off64_t file_offset, int rtld_flags);
+ ~soinfo();
void call_constructors();
void call_destructors();
@@ -346,6 +347,10 @@
void set_mapped_by_caller(bool reserved_map);
bool is_mapped_by_caller() const;
+ uintptr_t get_handle() const;
+ void generate_handle();
+ void* to_handle();
+
private:
bool elf_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
ElfW(Sym)* elf_addr_lookup(const void* addr);
@@ -410,6 +415,7 @@
// version >= 3
std::vector<std::string> dt_runpath_;
android_namespace_t* namespace_;
+ uintptr_t handle_;
friend soinfo* get_libdl_info();
};
@@ -432,8 +438,8 @@
void do_android_get_LD_LIBRARY_PATH(char*, size_t);
void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
-soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo, void* caller_addr);
-void do_dlclose(soinfo* si);
+void* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo, void* caller_addr);
+int do_dlclose(void* handle);
int do_dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data);