Rizin
unix-like reverse engineering framework and cli tools
|
Modified read proxy of Mach-O binaries for use as part of a virtual file. More...
#include "mach0.h"
Go to the source code of this file.
Classes | |
struct | BufCtx |
Macros | |
#define | IS_PTR_AUTH(x) ((x & (1ULL << 63)) != 0) |
#define | IS_PTR_BIND(x) ((x & (1ULL << 62)) != 0) |
Functions | |
RZ_API void MACH0_() | rebase_buffer (struct MACH0_(obj_t) *obj, ut64 off, ut8 *buf, ut64 count) |
static bool | buf_init (RzBuffer *b, const void *user) |
static bool | buf_fini (RzBuffer *b) |
static bool | buf_resize (RzBuffer *b, ut64 newsize) |
static st64 | buf_read (RzBuffer *b, ut8 *buf, ut64 len) |
static st64 | buf_write (RzBuffer *b, const ut8 *buf, ut64 len) |
static ut64 | buf_get_size (RzBuffer *b) |
static st64 | buf_seek (RzBuffer *b, st64 addr, int whence) |
static ut8 * | buf_get_whole_buf (RzBuffer *b, ut64 *sz) |
RZ_API RzBuffer *MACH0_() | new_rebasing_and_stripping_buf (struct MACH0_(obj_t) *obj) |
RZ_API bool MACH0_() | needs_rebasing_and_stripping (struct MACH0_(obj_t) *obj) |
RZ_API bool MACH0_() | segment_needs_rebasing_and_stripping (struct MACH0_(obj_t) *obj, size_t seg_index) |
Variables | |
static const RzBufferMethods | buf_methods |
Modified read proxy of Mach-O binaries for use as part of a virtual file.
This is used in Mach-O binaries that either contain LC_DYLD_CHANGED_FIXUPS/LC_DYLD_EXPORTS_TRIE load commands or BIND_OPCODE_THREADED in their dyld info. This is especially present in, but not limited to binaries with the "arm64e" architecture, as Apple calls it, which is essentially arm64 with pointer authentication. In particular, we strip away additional info stored inside of pointers in the binary so we get the raw pointers out for convenient analysis.
see also mach0_relocs.c for additional modification of the data that might happen.
Definition in file mach0_rebase.c.
Definition at line 21 of file mach0_rebase.c.
Definition at line 22 of file mach0_rebase.c.
Definition at line 171 of file mach0_rebase.c.
Definition at line 198 of file mach0_rebase.c.
References b, and rz_buf_size().
Definition at line 208 of file mach0_rebase.c.
References b, and rz_buf_data().
Definition at line 182 of file mach0_rebase.c.
References b, len, MACH0_, r, rebase_buffer(), rz_buf_read_at(), RZ_MIN, and st64.
Definition at line 177 of file mach0_rebase.c.
References b, and rz_buf_resize().
Definition at line 203 of file mach0_rebase.c.
References addr, b, rz_buf_size(), and rz_seek_offset().
Definition at line 193 of file mach0_rebase.c.
References b, len, and rz_buf_write_at().
Definition at line 228 of file mach0_rebase.c.
Referenced by get_virtual_files(), and parse_classes().
Definition at line 224 of file mach0_rebase.c.
References buf_methods, and rz_buf_new_with_methods().
Referenced by get_virtual_files(), and parse_classes().
Definition at line 24 of file mach0_rebase.c.
References bind, count, delta, DYLD_CHAINED_PTR_64_KERNEL_CACHE, DYLD_CHAINED_PTR_64_OFFSET, DYLD_CHAINED_PTR_ARM64E, DYLD_CHAINED_PTR_ARM64E_KERNEL, DYLD_CHAINED_PTR_ARM64E_USERLAND24, DYLD_CHAINED_PTR_START_NONE, test_evm::end, i, in_buf, IS_PTR_AUTH, IS_PTR_BIND, off, p, PFMT64x, rz_buf_read_at(), RZ_LOG_WARN, RZ_MAX, RZ_MIN, rz_read_le64(), rz_return_if_fail, rz_write_le64(), start, autogen_x86imm::tmp, and ut64().
Referenced by buf_read().
RZ_API bool MACH0_() segment_needs_rebasing_and_stripping | ( | struct MACH0_(obj_t) * | obj, |
size_t | seg_index | ||
) |
|
static |
Definition at line 213 of file mach0_rebase.c.
Referenced by new_rebasing_and_stripping_buf().