Lines Matching refs:si

287   soinfo* si = new (g_soinfo_allocator.alloc()) soinfo(ns, name, file_stat,  in soinfo_alloc()  local
290 solist_add_soinfo(si); in soinfo_alloc()
292 si->generate_handle(); in soinfo_alloc()
293 ns->add_soinfo(si); in soinfo_alloc()
295 TRACE("name %s: allocated soinfo @ %p", name, si); in soinfo_alloc()
296 return si; in soinfo_alloc()
299 static void soinfo_free(soinfo* si) { in soinfo_free() argument
300 if (si == nullptr) { in soinfo_free()
304 if (si->base != 0 && si->size != 0) { in soinfo_free()
305 if (!si->is_mapped_by_caller()) { in soinfo_free()
306 munmap(reinterpret_cast<void*>(si->base), si->size); in soinfo_free()
309 mmap(reinterpret_cast<void*>(si->base), si->size, PROT_NONE, in soinfo_free()
314 if (si->has_min_version(6) && si->get_gap_size()) { in soinfo_free()
315 munmap(reinterpret_cast<void*>(si->get_gap_start()), si->get_gap_size()); in soinfo_free()
318 TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si); in soinfo_free()
320 if (!solist_remove_soinfo(si)) { in soinfo_free()
321 async_safe_fatal("soinfo=%p is not in soinfo_list (double unload?)", si); in soinfo_free()
325 si->remove_all_links(); in soinfo_free()
327 si->~soinfo(); in soinfo_free()
328 g_soinfo_allocator.free(si); in soinfo_free()
392 if (soinfo* si = find_containing_library(reinterpret_cast<void*>(pc))) { in do_dl_unwind_find_exidx() local
393 *pcount = si->ARM_exidx_count; in do_dl_unwind_find_exidx()
394 return reinterpret_cast<_Unwind_Ptr>(si->ARM_exidx); in do_dl_unwind_find_exidx()
406 for (soinfo* si = solist_get_head(); si != nullptr; si = si->next) { in do_dl_iterate_phdr() local
408 dl_info.dlpi_addr = si->link_map_head.l_addr; in do_dl_iterate_phdr()
409 dl_info.dlpi_name = si->link_map_head.l_name; in do_dl_iterate_phdr()
410 dl_info.dlpi_phdr = si->phdr; in do_dl_iterate_phdr()
411 dl_info.dlpi_phnum = si->phnum; in do_dl_iterate_phdr()
414 if (soinfo_tls* tls_module = si->get_tls()) { in do_dl_iterate_phdr()
525 void set_soinfo(soinfo* si) { in set_soinfo() argument
526 si_ = si; in set_soinfo()
674 soinfo* si; in walk_dependencies_tree() local
675 while ((si = visit_list.pop_front()) != nullptr) { in walk_dependencies_tree()
676 if (visited.contains(si)) { in walk_dependencies_tree()
680 walk_action_result_t result = action(si); in walk_dependencies_tree()
686 visited.push_back(si); in walk_dependencies_tree()
689 si->get_children().for_each([&](soinfo* child) { in walk_dependencies_tree()
758 soinfo* si = *it; in ElfW() local
762 if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 && si->get_target_sdk_version() >= 23) { in ElfW()
766 s = si->find_symbol_by_name(symbol_name, vi); in ElfW()
768 *found = si; in ElfW()
795 static const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, in ElfW()
806 if (si == solist_get_somain()) { in ElfW()
815 return dlsym_handle_lookup_impl(si->get_primary_namespace(), si, nullptr, found, symbol_name, vi); in ElfW()
822 for (soinfo* si = solist_get_head(); si != nullptr; si = si->next) { in find_containing_library() local
823 if (address < si->base || address - si->base >= si->size) { in find_containing_library()
826 ElfW(Addr) vaddr = address - si->load_bias; in find_containing_library()
827 for (size_t i = 0; i != si->phnum; ++i) { in find_containing_library()
828 const ElfW(Phdr)* phdr = &si->phdr[i]; in find_containing_library()
833 return si; in find_containing_library()
1084 auto predicate = [&](soinfo* si) { in find_loaded_library_by_inode() argument
1085 return si->get_st_ino() == file_stat.st_ino && in find_loaded_library_by_inode()
1086 si->get_st_dev() == file_stat.st_dev && in find_loaded_library_by_inode()
1087 si->get_file_offset() == file_offset; in find_loaded_library_by_inode()
1095 soinfo* si = linked_ns->soinfo_list().find_if(predicate); in find_loaded_library_by_inode() local
1097 if (si != nullptr && link.is_accessible(si->get_soname())) { in find_loaded_library_by_inode()
1098 *candidate = si; in find_loaded_library_by_inode()
1109 auto predicate = [&](soinfo* si) { return strcmp(realpath, si->get_realpath()) == 0; }; in find_loaded_library_by_realpath() argument
1116 soinfo* si = linked_ns->soinfo_list().find_if(predicate); in find_loaded_library_by_realpath() local
1118 if (si != nullptr && link.is_accessible(si->get_soname())) { in find_loaded_library_by_realpath()
1119 *candidate = si; in find_loaded_library_by_realpath()
1165 soinfo* si = nullptr; in load_library() local
1166 if (find_loaded_library_by_inode(ns, file_stat, file_offset, search_linked_namespaces, &si)) { in load_library()
1170 ns->get_name(), name, si->get_realpath()); in load_library()
1171 task->set_soinfo(si); in load_library()
1233 soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags); in load_library() local
1235 task->set_soinfo(si); in load_library()
1241 soinfo_free(si); in load_library()
1252 si->set_dt_runpath(elf_reader.get_string(d->d_un.d_val)); in load_library()
1255 si->set_soname(elf_reader.get_string(d->d_un.d_val)); in load_library()
1263 if (si->get_dt_runpath().empty()) { in load_library()
1264 si->set_dt_runpath("$ORIGIN/../lib64:$ORIGIN/lib64"); in load_library()
1271 load_tasks->push_back(LoadTask::create(name, si, ns, task->get_readers_map())); in load_library()
1341 return !ns->soinfo_list().visit([&](soinfo* si) { in find_loaded_library_by_soname() argument
1342 const char* soname = si->get_soname(); in find_loaded_library_by_soname()
1344 *candidate = si; in find_loaded_library_by_soname()
1494 static void soinfo_unload(soinfo* si);
1582 soinfo* si = task->get_soinfo(); in find_libraries() local
1585 needed_by->add_child(si); in find_libraries()
1591 ld_preloads->push_back(si); in find_libraries()
1595 soinfos[soinfos_count++] = si; in find_libraries()
1602 soinfo* si = task->get_soinfo(); in find_libraries() local
1604 return t->get_soinfo() == si; in find_libraries()
1607 if (!si->is_linked() && in find_libraries()
1646 soinfo* si = task->get_soinfo(); in find_libraries() local
1647 if (!si->is_linked() && !si->prelink_image()) { in find_libraries()
1650 register_soinfo_tls(si); in find_libraries()
1659 for (auto&& si : *ld_preloads) { in find_libraries()
1660 si->set_dt_flags_1(si->get_dt_flags_1() | DF_1_GLOBAL); in find_libraries()
1668 soinfo* si = task->get_soinfo(); in find_libraries() local
1669 if (!si->is_linked() && (si->get_dt_flags_1() & DF_1_GLOBAL) != 0) { in find_libraries()
1670 new_global_group_members.push_back(si); in find_libraries()
1677 for (auto si : new_global_group_members) { in find_libraries() local
1678 if (si->get_primary_namespace() != linked_ns) { in find_libraries()
1679 linked_ns->add_soinfo(si); in find_libraries()
1680 si->add_secondary_namespace(linked_ns); in find_libraries()
1700 soinfo* si = task->get_soinfo(); in find_libraries() local
1706 if (!si->is_linked() && si->get_primary_namespace() != needed_by_ns) { in find_libraries()
1707 auto it = std::find(local_group_roots.begin(), local_group_roots.end(), si); in find_libraries()
1710 si->get_realpath(), in find_libraries()
1711 si, in find_libraries()
1712 si->get_primary_namespace()->get_name(), in find_libraries()
1713 si->get_primary_namespace(), in find_libraries()
1723 local_group_roots.push_back(si); in find_libraries()
1734 [&] (soinfo* si) { in find_libraries() argument
1735 if (local_group_ns->is_accessible(si)) { in find_libraries()
1736 local_group.push_back(si); in find_libraries()
1747 bool linked = local_group.visit([&](soinfo* si) { in find_libraries() argument
1751 if (!si->is_linked() && si->get_primary_namespace() == local_group_ns) { in find_libraries()
1753 if (si == soinfos[0] || reserved_address_recursive) { in find_libraries()
1759 __libc_shared_globals()->load_hook(si->load_bias, si->phdr, si->phnum); in find_libraries()
1761 lookup_list.set_dt_symbolic_lib(si->has_DT_SYMBOLIC ? si : nullptr); in find_libraries()
1762 if (!si->link_image(lookup_list, local_group_root, link_extinfo, &relro_fd_offset) || in find_libraries()
1763 !get_cfi_shadow()->AfterLoad(si, solist_get_head())) { in find_libraries()
1785 soinfo* si = task->get_soinfo(); in find_libraries() local
1786 si->set_linked(); in find_libraries()
1790 soinfo* si = task->get_soinfo(); in find_libraries() local
1794 needed_by->get_local_group_root() != si->get_local_group_root()) { in find_libraries()
1795 si->increment_ref_count(); in find_libraries()
1807 soinfo* si = nullptr; in find_library() local
1810 si = solist_get_somain(); in find_library()
1815 &si, in find_library()
1821 if (si != nullptr) { in find_library()
1822 soinfo_unload(si); in find_library()
1827 si->increment_ref_count(); in find_library()
1829 return si; in find_library()
1850 soinfo* si = nullptr; in soinfo_unload_impl() local
1852 while ((si = unload_list.pop_front()) != nullptr) { in soinfo_unload_impl()
1853 if (local_unload_list.contains(si)) { in soinfo_unload_impl()
1857 local_unload_list.push_back(si); in soinfo_unload_impl()
1859 if (si->has_min_version(0)) { in soinfo_unload_impl()
1861 while ((child = si->get_children().pop_front()) != nullptr) { in soinfo_unload_impl()
1862 TRACE("%s@%p needs to unload %s@%p", si->get_realpath(), si, in soinfo_unload_impl()
1865 child->get_parents().remove(si); in soinfo_unload_impl()
1876 async_safe_fatal("soinfo for \"%s\"@%p has no version", si->get_realpath(), si); in soinfo_unload_impl()
1880 local_unload_list.for_each([](soinfo* si) { in soinfo_unload_impl() argument
1883 si->get_realpath(), in soinfo_unload_impl()
1884 si); in soinfo_unload_impl()
1885 si->call_destructors(); in soinfo_unload_impl()
1888 si->get_realpath(), in soinfo_unload_impl()
1889 si); in soinfo_unload_impl()
1892 while ((si = local_unload_list.pop_front()) != nullptr) { in soinfo_unload_impl()
1895 si->get_realpath(), in soinfo_unload_impl()
1896 si); in soinfo_unload_impl()
1898 notify_gdb_of_unload(si); in soinfo_unload_impl()
1899 unregister_soinfo_tls(si); in soinfo_unload_impl()
1901 __libc_shared_globals()->unload_hook(si->load_bias, si->phdr, si->phnum); in soinfo_unload_impl()
1903 get_cfi_shadow()->BeforeUnload(si); in soinfo_unload_impl()
1904 soinfo_free(si); in soinfo_unload_impl()
1908 while ((si = external_unload_list.pop_front()) != nullptr) { in soinfo_unload_impl()
1911 si->get_realpath(), in soinfo_unload_impl()
1912 si); in soinfo_unload_impl()
1913 soinfo_unload(si); in soinfo_unload_impl()
1961 soinfo* si = find_containing_library(dso_handle); in increment_dso_handle_reference_counter() local
1962 if (si != nullptr) { in increment_dso_handle_reference_counter()
1964 si->increment_ref_count(); in increment_dso_handle_reference_counter()
1984 soinfo* si = find_containing_library(dso_handle); in decrement_dso_handle_reference_counter() local
1985 if (si != nullptr) { in decrement_dso_handle_reference_counter()
1987 soinfo_unload(si); in decrement_dso_handle_reference_counter()
2150 soinfo* si = nullptr; in do_dlopen() local
2151 if (find_loaded_library_by_realpath(ns, original_path, true, &si)) { in do_dlopen()
2163 soinfo* si = find_library(ns, translated_name, flags, extinfo, caller); in do_dlopen() local
2166 if (si != nullptr) { in do_dlopen()
2167 void* handle = si->to_handle(); in do_dlopen()
2170 si->get_realpath(), si->get_soname(), handle); in do_dlopen()
2171 si->call_constructors(); in do_dlopen()
2175 si->get_realpath(), si->get_soname(), handle); in do_dlopen()
2184 soinfo* si = find_containing_library(addr); in do_dladdr() local
2185 if (si == nullptr) { in do_dladdr()
2191 info->dli_fname = si->get_realpath(); in do_dladdr()
2193 info->dli_fbase = reinterpret_cast<void*>(si->base); in do_dladdr()
2196 ElfW(Sym)* sym = si->find_symbol_by_address(addr); in do_dladdr()
2198 info->dli_sname = si->get_string(sym->st_name); in do_dladdr()
2199 info->dli_saddr = reinterpret_cast<void*>(si->resolve_symbol_address(sym)); in do_dladdr()
2235 soinfo* si = nullptr; in do_dlsym() local
2237 si = soinfo_from_handle(handle); in do_dlsym()
2243 si != nullptr ? si->get_realpath() : "n/a", in do_dlsym()
2270 if (si == nullptr) { in do_dlsym()
2274 sym = dlsym_handle_lookup(si, &found, sym_name, vi); in do_dlsym()
2314 soinfo* si = soinfo_from_handle(handle); in do_dlclose() local
2315 if (si == nullptr) { in do_dlclose()
2323 si->get_realpath(), in do_dlclose()
2324 si); in do_dlclose()
2325 soinfo_unload(si); in do_dlclose()
2381 for (auto si : soinfos) { in add_soinfos_to_namespace() local
2382 si->add_secondary_namespace(ns); in add_soinfos_to_namespace()
2574 soinfo* target_si = si_from->get_children().find_if([&](const soinfo* si) { in init_verneed() argument
2575 return si->get_soname() != nullptr && strcmp(si->get_soname(), target_soname) == 0; in init_verneed()
2600 static bool for_each_verdef(const soinfo* si, F functor) { in for_each_verdef() argument
2601 if (!si->has_min_version(2)) { in for_each_verdef()
2605 uintptr_t verdef_ptr = si->get_verdef_ptr(); in for_each_verdef()
2612 size_t verdef_cnt = si->get_verdef_cnt(); in for_each_verdef()
2620 i, verdef->vd_version, si->get_realpath()); in for_each_verdef()
2647 ElfW(Versym) find_verdef_version_index(const soinfo* si, const version_info* vi) { in find_verdef_version_index() argument
2654 if (!for_each_verdef(si, in find_verdef_version_index()
2657 strcmp(vi->name, si->get_string(verdaux->vda_name)) == 0) { in find_verdef_version_index()
2667 si->get_realpath(), linker_get_error_buffer()); in find_verdef_version_index()
2674 bool validate_verdef_section(const soinfo* si) { in validate_verdef_section() argument
2675 return for_each_verdef(si, in validate_verdef_section()