Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | MAX_N_HDR 16 |
#define | SHIFT_MAYBE(x) |
#define MAX_N_HDR 16 |
Definition at line 11 of file dyldcache.c.
|
static |
Definition at line 436 of file dyldcache.c.
References rz_dyldcache_t::buf, cmd, test_evm::end, found, free(), rz_dyldcache_t::hdr, cache_hdr_t::imagesCount, key, LC_LOAD_DYLIB, LC_LOAD_UPWARD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, MACH0_, malloc(), rz_dyldcache_t::maps, MH_MAGIC_64, rz_dyldcache_t::n_maps, NULL, rz_buf_fread_at(), rz_buf_read_at(), RZ_LOG_INFO, RZ_LOG_WARN, rz_read_le32(), ut64(), UT64_MAX, and va2pa().
Referenced by create_cache_bins().
|
static |
Definition at line 485 of file dyldcache.c.
References rz_dyldcache_t::accel, cache_img_t::address, bins, rz_dyldcache_t::buf, carve_deps_at_address(), create_path_to_index(), cache_accel_t::depListCount, cache_accel_t::depListOffset, free(), free_bin(), get_lib_name(), rz_dyldcache_t::hdr, rz_dyldcache_t::hdr_offset, i, cache_hdr_t::imagesCount, k, cache_hdr_t::mappingCount, rz_dyldcache_t::maps, rz_dyldcache_t::maps_index, MH_MAGIC_64, rz_dyldcache_t::n_hdr, NULL, cache_img_t::pathFileOffset, read_cache_images(), read_cache_imgextra(), rz_buf_fread_at(), rz_buf_read_at(), RZ_FREE, rz_list_append(), rz_list_find(), rz_list_free(), rz_list_newf(), RZ_LOG_INFO, RZ_LOG_WARN, RZ_NEW0, RZ_NEWS0, rz_read_le32(), rz_str_split_list(), rz_sys_getenv(), strdup(), string_contains(), rz_dyldcache_t::symbols_off_base, ut64(), UT64_MAX, and va2pa().
Referenced by rz_dyldcache_new_buf().
|
static |
Definition at line 419 of file dyldcache.c.
References i, cache_hdr_t::imagesCount, NULL, rz_buf_read_at(), and ut64().
Referenced by create_cache_bins().
|
static |
Definition at line 674 of file dyldcache.c.
References rz_dyldcache_t::bins, rz_dyldcache_t::buf, free(), get_sections(), i, MACH0_, mach0_free(), malloc(), rz_dyldcache_t::n_hdr, NULL, off, rz_buf_fread_at(), RZ_MIN, sections(), and ut64().
Referenced by get_rebase_info().
|
static |
|
static |
Definition at line 405 of file dyldcache.c.
References file, cache_img_t::pathFileOffset, rz_buf_read_at(), and strdup().
Referenced by create_cache_bins().
|
static |
Definition at line 764 of file dyldcache.c.
References rz_dyld_rebase_info_3_t::auth_value_add, cache_slide3_t::auth_value_add, rz_dyldcache_t::buf, rz_dyld_rebase_info_3_t::delta_mask, rz_dyld_rebase_info_2_t::delta_mask, cache_slide2_t::delta_mask, rz_dyld_rebase_info_3_t::delta_shift, rz_dyld_rebase_info_2_t::delta_shift, dumb_ctzll(), rz_dyld_rebase_info_1_t::entries, cache_slide1_t::entries_count, cache_slide1_t::entries_offset, rz_dyld_rebase_info_1_t::entries_size, cache_slide1_t::entries_size, estimate_slide(), free(), malloc(), NULL, rz_dyld_rebase_info_3_t::one_page_buf, rz_dyld_rebase_info_2_t::one_page_buf, rz_dyld_rebase_info_1_t::one_page_buf, rz_dyld_rebase_info_2_t::page_extras, rz_dyld_rebase_info_2_t::page_extras_count, cache_slide2_t::page_extras_count, cache_slide2_t::page_extras_offset, rz_dyld_rebase_info_3_t::page_size, rz_dyld_rebase_info_2_t::page_size, rz_dyld_rebase_info_1_t::page_size, cache_slide3_t::page_size, cache_slide2_t::page_size, rz_dyld_rebase_info_3_t::page_starts, rz_dyld_rebase_info_2_t::page_starts, rz_dyld_rebase_info_3_t::page_starts_count, rz_dyld_rebase_info_2_t::page_starts_count, cache_slide3_t::page_starts_count, cache_slide2_t::page_starts_count, cache_slide2_t::page_starts_offset, PFMT64x, rz_buf_fread_at(), rz_buf_read_at(), RZ_LOG_ERROR, RZ_LOG_INFO, RZ_NEW0, rz_dyld_rebase_info_3_t::slide, rz_dyld_rebase_info_2_t::slide, rz_dyld_rebase_info_1_t::slide, rz_dyld_rebase_info_3_t::start_of_data, rz_dyld_rebase_info_2_t::start_of_data, rz_dyld_rebase_info_1_t::start_of_data, rz_dyld_rebase_info_1_t::toc, rz_dyld_rebase_info_1_t::toc_count, cache_slide1_t::toc_count, cache_slide1_t::toc_offset, ut64(), UT64_MAX, rz_dyld_rebase_info_2_t::value_add, cache_slide2_t::value_add, rz_dyld_rebase_info_2_t::value_mask, rz_dyld_rebase_info_3_t::version, rz_dyld_rebase_info_2_t::version, and rz_dyld_rebase_info_1_t::version.
Referenced by get_rebase_infos().
|
static |
Definition at line 991 of file dyldcache.c.
References rz_dyldcache_t::buf, rz_dyld_rebase_infos_entry_t::end, rz_dyld_rebase_infos_t::entries, cache_map_t::fileOffset, free(), get_rebase_info(), rz_dyldcache_t::hdr, rz_dyldcache_t::hdr_offset, i, rz_dyld_rebase_infos_entry_t::info, k, rz_dyld_rebase_infos_t::length, cache_hdr_t::mappingCount, rz_dyldcache_t::maps, MAX_N_HDR, memcpy(), rz_dyldcache_t::n_hdr, NULL, rz_buf_fread_at(), rz_buf_read_le32_at, RZ_NEW0, RZ_NEWS0, cache_map_t::size, entry::size, rz_dyld_rebase_info_t::slide, cache_hdr_t::slideInfoOffset, cache_hdr_t::slideInfoSize, rz_dyld_rebase_infos_entry_t::start, ut64(), and UT64_MAX.
Referenced by rz_dyldcache_new_buf().
|
static |
Definition at line 346 of file dyldcache.c.
References cache_img_t::address, rz_dyldcache_t::bins, rz_dyldcache_t::buf, rz_list_iter_t::data, e, entries(), rz_dyldcache_t::hdr, i, cache_hdr_t::imagesCount, rz_list_iter_t::n, rz_dyldcache_t::n_hdr, NULL, read_cache_images(), RZ_FREE, rz_list_iterator(), and rz_return_if_fail.
Referenced by rz_dyld_locsym_new().
|
static |
Definition at line 81 of file dyldcache.c.
References rz_dyldcache_t::buf, h, rz_dyldcache_t::hdr, rz_dyldcache_t::hdr_offset, i, MAX_N_HDR, memcpy(), rz_dyldcache_t::n_hdr, NULL, read_cache_header(), RZ_FREE, rz_list_append(), rz_list_free(), rz_list_newf(), RZ_NEWS0, SHIFT_MAYBE, and ut64().
Referenced by rz_dyldcache_new_buf().
|
static |
Definition at line 151 of file dyldcache.c.
References rz_dyldcache_t::buf, rz_dyldcache_t::hdr, rz_dyldcache_t::hdr_offset, i, if(), map(), cache_hdr_t::mappingCount, cache_hdr_t::mappingOffset, rz_dyldcache_t::maps, maps(), rz_dyldcache_t::maps_index, max_count, rz_dyldcache_t::n_hdr, rz_dyldcache_t::n_maps, NULL, rz_buf_fread_at(), RZ_MAX, RZ_NEWS0, rz_return_if_fail, rz_dyldcache_t::symbols_off_base, UT32_MAX, and ut64().
Referenced by rz_dyldcache_new_buf().
|
static |
Definition at line 214 of file dyldcache.c.
References cache_hdr_t::accelerateInfoAddr, cache_hdr_t::accelerateInfoSize, cache_accel_t::bottomUpListOffset, cache_accel_t::depListOffset, cache_accel_t::dofSectionsOffset, cache_accel_t::dylibTrieOffset, cache_accel_t::imagesExtrasOffset, cache_accel_t::initializersOffset, cache_hdr_t::mappingCount, maps(), NULL, cache_accel_t::rangeTableOffset, cache_accel_t::reExportListOffset, rz_buf_fread_at(), RZ_FREE, RZ_NEW0, ut64(), and va2pa().
Referenced by rz_dyldcache_new_buf().
|
static |
Definition at line 52 of file dyldcache.c.
References free(), cache_hdr_t::imagesCount, cache_hdr_t::imagesOffset, cache_hdr_t::magic, NULL, rz_buf_fread_at(), rz_buf_read_le32_at, rz_dyldcache_check_magic(), RZ_NEW0, and ut64().
Referenced by populate_cache_headers().
|
static |
Definition at line 316 of file dyldcache.c.
References i, cache_hdr_t::imagesCount, cache_hdr_t::imagesOffset, NULL, cache_img_t::pathFileOffset, rz_buf_fread_at(), RZ_FREE, RZ_NEWS0, UT32_MAX, and ut64().
Referenced by create_cache_bins(), and match_bin_entries().
|
static |
Definition at line 386 of file dyldcache.c.
References cache_accel_t::imageExtrasCount, cache_hdr_t::imagesCount, cache_accel_t::imagesExtrasOffset, NULL, rz_buf_fread_at(), RZ_FREE, RZ_NEWS0, and ut64().
Referenced by create_cache_bins().
|
static |
Definition at line 1215 of file dyldcache.c.
References rz_dyld_rebase_info_1_t::entries, free(), and rz_dyld_rebase_info_1_t::toc.
Referenced by rebase_info_free().
|
static |
Definition at line 1206 of file dyldcache.c.
References free(), rz_dyld_rebase_info_2_t::page_extras, and rz_dyld_rebase_info_2_t::page_starts.
Referenced by rebase_info_free().
|
static |
Definition at line 1198 of file dyldcache.c.
References free(), and rz_dyld_rebase_info_3_t::page_starts.
Referenced by rebase_info_free().
|
static |
Definition at line 1224 of file dyldcache.c.
References free(), rz_dyld_rebase_info_t::one_page_buf, rebase_info1_free(), rebase_info2_free(), rebase_info3_free(), RZ_FREE, and rz_dyld_rebase_info_t::version.
Referenced by rz_dyldcache_free().
|
static |
Definition at line 1244 of file dyldcache.c.
References rz_dyldcache_t::buf, entries(), free(), rz_dyldcache_t::hdr, i, cache_hdr_t::imagesCount, info(), rz_dyld_loc_sym_t::local_symbols_offset, cache_hdr_t::localSymbolsOffset, cache_hdr_t::localSymbolsSize, match_bin_entries(), rz_dyldcache_t::n_hdr, rz_dyld_loc_sym_t::nlists_count, rz_dyld_loc_sym_t::nlists_offset, NULL, rz_buf_fread_at(), RZ_LOG_ERROR, RZ_NEW0, RZ_NEWS0, rz_return_val_if_fail, rz_dyld_loc_sym_t::strings_offset, rz_dyld_loc_sym_t::strings_size, and ut64().
Referenced by rz_dyldcache_new_buf().
magic | zero-terminated string from the beginning of some file |
Definition at line 18 of file dyldcache.c.
Referenced by check_buffer(), and read_cache_header().
RZ_API void rz_dyldcache_free | ( | RzDyldCache * | cache | ) |
Definition at line 1325 of file dyldcache.c.
References rz_dyldcache_t::accel, rz_dyldcache_t::bins, rz_dyldcache_t::buf, rz_dyld_rebase_infos_t::entries, free(), rz_dyldcache_t::hdr, rz_dyldcache_t::hdr_offset, i, rz_dyld_rebase_infos_entry_t::info, rz_dyld_rebase_infos_t::length, rz_dyldcache_t::locsym, rz_dyldcache_t::maps, rz_dyldcache_t::maps_index, NULL, rz_dyldcache_t::oi, rebase_info_free(), rz_dyldcache_t::rebase_infos, rz_buf_free(), RZ_FREE, and rz_list_free().
Referenced by destroy(), and rz_dyldcache_new_buf().
RZ_API objc_cache_opt_info* rz_dyldcache_get_objc_opt_info | ( | RzBinFile * | bf, |
RzDyldCache * | cache | ||
) |
Definition at line 247 of file dyldcache.c.
References addr, rz_dyldcache_t::bins, rz_dyldcache_t::buf, check, get_sections(), i, MACH0_, mach0_free(), rz_dyldcache_t::maps, rz_dyldcache_t::n_maps, NULL, rz_bin_file_t::rbin, rz_buf_read_le64_at, rz_dyldcache_get_slide(), RZ_FREE, RZ_NEW0, sections(), objc_cache_opt_info::sel_string_base, ut64(), va2pa(), and rz_bin_t::verbose.
Referenced by classes().
RZ_API ut64 rz_dyldcache_get_slide | ( | RzDyldCache * | cache | ) |
Definition at line 1097 of file dyldcache.c.
References rz_dyld_rebase_infos_t::entries, i, rz_dyld_rebase_infos_entry_t::info, rz_dyld_rebase_infos_t::length, rz_dyldcache_t::rebase_infos, rz_return_val_if_fail, and rz_dyld_rebase_info_t::slide.
Referenced by header(), maps(), rz_dyldcache_get_objc_opt_info(), rz_dyldcache_needs_rebasing(), rz_dyldcache_symbols_from_locsym(), rz_dyldcache_va2pa(), sections(), and symbols().
RZ_API RzDyldCache* rz_dyldcache_new_buf | ( | RzBuffer * | buf | ) |
Definition at line 1170 of file dyldcache.c.
References rz_dyldcache_t::accel, rz_dyldcache_t::bins, rz_dyldcache_t::buf, create_cache_bins(), get_rebase_infos(), rz_dyldcache_t::hdr, rz_dyldcache_t::locsym, rz_dyldcache_t::magic, rz_dyldcache_t::maps, memcpy(), NULL, populate_cache_headers(), populate_cache_maps(), read_cache_accel(), rz_dyldcache_t::rebase_infos, rz_buf_ref(), rz_dyld_locsym_new(), rz_dyldcache_free(), and RZ_NEW0.
Referenced by load_buffer().
RZ_API void rz_dyldcache_symbols_from_locsym | ( | RzDyldCache * | cache, |
RzDyldBinImage * | bin, | ||
RzList * | symbols, | ||
SetU * | hash | ||
) |
Definition at line 1113 of file dyldcache.c.
References rz_dyldcache_t::buf, free(), k, rz_dyld_loc_sym_t::local_symbols_offset, rz_dyldcache_t::locsym, MACH0_, rz_dyldcache_t::maps, rz_dyldcache_t::n_maps, nlist::n_strx, nlist::n_value, rz_bin_symbol_t::name, rz_dyld_loc_sym_t::nlists_count, rz_dyld_loc_sym_t::nlists_offset, NULL, rz_bin_symbol_t::paddr, rz_buf_fread_at(), rz_buf_get_string(), rz_dyldcache_get_slide(), rz_list_append(), RZ_LOG_ERROR, RZ_NEW0, RZ_NEWS0, rz_str_newf(), set_u_add(), set_u_contains(), rz_dyld_loc_sym_t::strings_offset, rz_dyld_loc_sym_t::strings_size, symbols(), rz_bin_symbol_t::type, ut64(), va2pa(), and rz_bin_symbol_t::vaddr.
Referenced by symbols().
Definition at line 1353 of file dyldcache.c.
References rz_dyldcache_t::buf, rz_dyldcache_t::maps, rz_dyldcache_t::n_maps, rz_dyldcache_get_slide(), rz_return_val_if_fail, ut64(), UT64_MAX, and va2pa().
Referenced by bin_obj_va2pa(), classes(), and sections_from_bin().
|
static |
Definition at line 22 of file dyldcache.c.
References addr, i, maps(), ut64(), and UT64_MAX.
Referenced by carve_deps_at_address(), create_cache_bins(), read_cache_accel(), rz_dyldcache_get_objc_opt_info(), rz_dyldcache_symbols_from_locsym(), and rz_dyldcache_va2pa().