16#ifndef LIEF_MACHO_CHAINED_PTR_ANALYSIS_H
17#define LIEF_MACHO_CHAINED_PTR_ANALYSIS_H
262 return std::unique_ptr<ChainedPointerAnalysis>(
308 return sizeof(uint64_t);
313 return sizeof(uint32_t);
470 const std::function<
int(uint64_t,
const union_pointer_t& ptr)>& callback);
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
PTR_TYPE
Definition ChainedPointerAnalysis.hpp:240
@ DYLD_CHAINED_PTR_ARM64E_SEGMENTED_REBASE
Definition ChainedPointerAnalysis.hpp:255
@ DYLD_CHAINED_PTR_64_KERNEL_CACHE_REBASE
Definition ChainedPointerAnalysis.hpp:250
@ DYLD_CHAINED_PTR_32_BIND
Definition ChainedPointerAnalysis.hpp:252
@ DYLD_CHAINED_PTR_32_REBASE
Definition ChainedPointerAnalysis.hpp:251
@ UNKNOWN
Definition ChainedPointerAnalysis.hpp:241
@ DYLD_CHAINED_PTR_64_BIND
Definition ChainedPointerAnalysis.hpp:249
@ DYLD_CHAINED_PTR_64_REBASE
Definition ChainedPointerAnalysis.hpp:246
@ DYLD_CHAINED_PTR_ARM64E_AUTH_BIND24
Definition ChainedPointerAnalysis.hpp:248
@ DYLD_CHAINED_PTR_ARM64E_AUTH_REBASE
Definition ChainedPointerAnalysis.hpp:244
@ DYLD_CHAINED_PTR_ARM64E_AUTH_SEGMENTED_REBASE
Definition ChainedPointerAnalysis.hpp:256
@ DYLD_CHAINED_PTR_32_CACHE_REBASE
Definition ChainedPointerAnalysis.hpp:253
@ DYLD_CHAINED_PTR_ARM64E_AUTH_BIND
Definition ChainedPointerAnalysis.hpp:245
@ DYLD_CHAINED_PTR_ARM64E_BIND
Definition ChainedPointerAnalysis.hpp:243
@ DYLD_CHAINED_PTR_32_FIRMWARE_REBASE
Definition ChainedPointerAnalysis.hpp:254
@ DYLD_CHAINED_PTR_ARM64E_BIND24
Definition ChainedPointerAnalysis.hpp:247
@ DYLD_CHAINED_PTR_ARM64E_REBASE
Definition ChainedPointerAnalysis.hpp:242
union_pointer_t get_as(DYLD_CHAINED_PTR_FORMAT fmt) const
ChainedPointerAnalysis(uint64_t value, size_t size)
Definition ChainedPointerAnalysis.hpp:318
const dyld_chained_ptr_arm64e_segmented_rebase_t dyld_chained_ptr_arm64e_segmented_rebase() const
Definition ChainedPointerAnalysis.hpp:417
const dyld_chained_ptr_32_bind_t dyld_chained_ptr_32_bind() const
Definition ChainedPointerAnalysis.hpp:399
const dyld_chained_ptr_64_bind_t dyld_chained_ptr_64_bind() const
Definition ChainedPointerAnalysis.hpp:381
const dyld_chained_ptr_64_rebase_t dyld_chained_ptr_64_rebase() const
Definition ChainedPointerAnalysis.hpp:363
size_t size() const
Definition ChainedPointerAnalysis.hpp:335
const dyld_chained_ptr_arm64e_rebase_t dyld_chained_ptr_arm64e_rebase() const
Definition ChainedPointerAnalysis.hpp:339
const dyld_chained_ptr_arm64e_auth_rebase_t dyld_chained_ptr_arm64e_auth_rebase() const
Definition ChainedPointerAnalysis.hpp:351
const dyld_chained_ptr_64_kernel_cache_rebase_t dyld_chained_ptr_64_kernel_cache_rebase() const
Definition ChainedPointerAnalysis.hpp:387
ChainedPointerAnalysis & operator=(const ChainedPointerAnalysis &)=default
const dyld_chained_ptr_arm64e_bind24_t dyld_chained_ptr_arm64e_bind24() const
Definition ChainedPointerAnalysis.hpp:369
const dyld_chained_ptr_32_rebase_t dyld_chained_ptr_32_rebase() const
Definition ChainedPointerAnalysis.hpp:393
static size_t stride(DYLD_CHAINED_PTR_FORMAT fmt)
Definition ChainedPointerAnalysis.hpp:266
const dyld_chained_ptr_arm64e_auth_segmented_rebase_t dyld_chained_ptr_arm64e_auth_segmented_rebase() const
Definition ChainedPointerAnalysis.hpp:423
const dyld_chained_ptr_32_firmware_rebase_t dyld_chained_ptr_32_firmware_rebase() const
Definition ChainedPointerAnalysis.hpp:411
const dyld_chained_ptr_arm64e_bind_t dyld_chained_ptr_arm64e_bind() const
Definition ChainedPointerAnalysis.hpp:345
const dyld_chained_ptr_arm64e_auth_bind_t dyld_chained_ptr_arm64e_auth_bind() const
Definition ChainedPointerAnalysis.hpp:357
ChainedPointerAnalysis(ChainedPointerAnalysis &&) noexcept=default
static std::unique_ptr< ChainedPointerAnalysis > from_value(uint64_t value, size_t size)
Definition ChainedPointerAnalysis.hpp:259
const dyld_chained_ptr_32_cache_rebase_t dyld_chained_ptr_32_cache_rebase() const
Definition ChainedPointerAnalysis.hpp:405
static size_t ptr_size(DYLD_CHAINED_PTR_FORMAT fmt)
Definition ChainedPointerAnalysis.hpp:293
ChainedPointerAnalysis(const ChainedPointerAnalysis &)=default
const dyld_chained_ptr_arm64e_auth_bind24_t dyld_chained_ptr_arm64e_auth_bind24() const
Definition ChainedPointerAnalysis.hpp:375
uint64_t value() const
Definition ChainedPointerAnalysis.hpp:331
static uint64_t walk_chain(BinaryStream &stream, DYLD_CHAINED_PTR_FORMAT format, const std::function< int(uint64_t, const union_pointer_t &ptr)> &callback)
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
DYLD_CHAINED_PTR_FORMAT
Definition DyldChainedFormat.hpp:29
@ PTR_32
Definition DyldChainedFormat.hpp:33
@ PTR_32_FIRMWARE
Definition DyldChainedFormat.hpp:35
@ PTR_ARM64E_SHARED_CACHE
Definition DyldChainedFormat.hpp:44
@ PTR_ARM64E_USERLAND24
Definition DyldChainedFormat.hpp:43
@ PTR_32_CACHE
Definition DyldChainedFormat.hpp:34
@ PTR_64_KERNEL_CACHE
Definition DyldChainedFormat.hpp:39
@ PTR_ARM64E_KERNEL
Definition DyldChainedFormat.hpp:38
@ PTR_ARM64E_FIRMWARE
Definition DyldChainedFormat.hpp:41
@ PTR_X86_64_KERNEL_CACHE
Definition DyldChainedFormat.hpp:42
@ NONE
Definition DyldChainedFormat.hpp:30
@ PTR_ARM64E
Definition DyldChainedFormat.hpp:31
@ PTR_64
Definition DyldChainedFormat.hpp:32
@ PTR_64_OFFSET
Definition DyldChainedFormat.hpp:36
@ PTR_ARM64E_SEGMENTED
Definition DyldChainedFormat.hpp:45
@ PTR_ARM64E_USERLAND
Definition DyldChainedFormat.hpp:40
LIEF namespace.
Definition Abstract/Binary.hpp:40
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:75
Definition ChainedPointerAnalysis.hpp:182
uint32_t next
Definition ChainedPointerAnalysis.hpp:185
uint32_t ordinal
Definition ChainedPointerAnalysis.hpp:183
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_32_bind_t &chain)
uint32_t addend
Definition ChainedPointerAnalysis.hpp:184
uint32_t bind
Definition ChainedPointerAnalysis.hpp:186
Definition ChainedPointerAnalysis.hpp:194
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_32_cache_rebase_t &chain)
uint32_t next
Definition ChainedPointerAnalysis.hpp:196
uint32_t target
Definition ChainedPointerAnalysis.hpp:195
Definition ChainedPointerAnalysis.hpp:204
uint32_t target
Definition ChainedPointerAnalysis.hpp:205
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_32_firmware_rebase_t &chain)
uint32_t next
Definition ChainedPointerAnalysis.hpp:206
Definition ChainedPointerAnalysis.hpp:171
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_32_rebase_t &chain)
uint32_t bind
Definition ChainedPointerAnalysis.hpp:174
uint32_t target
Definition ChainedPointerAnalysis.hpp:172
uint32_t next
Definition ChainedPointerAnalysis.hpp:173
Definition ChainedPointerAnalysis.hpp:143
uint64_t addend
Definition ChainedPointerAnalysis.hpp:145
uint64_t ordinal
Definition ChainedPointerAnalysis.hpp:144
uint64_t reserved
Definition ChainedPointerAnalysis.hpp:146
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_64_bind_t &chain)
uint64_t next
Definition ChainedPointerAnalysis.hpp:147
uint64_t bind
Definition ChainedPointerAnalysis.hpp:148
Definition ChainedPointerAnalysis.hpp:156
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_64_kernel_cache_rebase_t &chain)
uint64_t cache_level
Definition ChainedPointerAnalysis.hpp:158
uint64_t addr_div
Definition ChainedPointerAnalysis.hpp:160
uint64_t target
Definition ChainedPointerAnalysis.hpp:157
uint64_t diversity
Definition ChainedPointerAnalysis.hpp:159
uint64_t key
Definition ChainedPointerAnalysis.hpp:161
uint64_t next
Definition ChainedPointerAnalysis.hpp:162
uint64_t is_auth
Definition ChainedPointerAnalysis.hpp:163
Definition ChainedPointerAnalysis.hpp:96
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_64_rebase_t &chain)
uint64_t unpack_target() const
Definition ChainedPointerAnalysis.hpp:106
uint64_t reserved
Definition ChainedPointerAnalysis.hpp:99
uint64_t target
Definition ChainedPointerAnalysis.hpp:97
uint64_t high8
Definition ChainedPointerAnalysis.hpp:98
uint64_t next
Definition ChainedPointerAnalysis.hpp:100
uint64_t bind
Definition ChainedPointerAnalysis.hpp:101
Definition ChainedPointerAnalysis.hpp:127
uint64_t auth
Definition ChainedPointerAnalysis.hpp:135
uint64_t bind
Definition ChainedPointerAnalysis.hpp:134
uint64_t zero
Definition ChainedPointerAnalysis.hpp:129
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_auth_bind24_t &chain)
uint64_t ordinal
Definition ChainedPointerAnalysis.hpp:128
uint64_t diversity
Definition ChainedPointerAnalysis.hpp:130
uint64_t addr_div
Definition ChainedPointerAnalysis.hpp:131
uint64_t key
Definition ChainedPointerAnalysis.hpp:132
uint64_t next
Definition ChainedPointerAnalysis.hpp:133
Definition ChainedPointerAnalysis.hpp:80
uint64_t key
Definition ChainedPointerAnalysis.hpp:85
uint64_t auth
Definition ChainedPointerAnalysis.hpp:88
uint64_t addr_div
Definition ChainedPointerAnalysis.hpp:84
uint64_t zero
Definition ChainedPointerAnalysis.hpp:82
uint64_t diversity
Definition ChainedPointerAnalysis.hpp:83
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_auth_bind_t &chain)
uint64_t next
Definition ChainedPointerAnalysis.hpp:86
uint64_t ordinal
Definition ChainedPointerAnalysis.hpp:81
uint64_t bind
Definition ChainedPointerAnalysis.hpp:87
Definition ChainedPointerAnalysis.hpp:65
uint64_t diversity
Definition ChainedPointerAnalysis.hpp:67
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_auth_rebase_t &chain)
uint64_t auth
Definition ChainedPointerAnalysis.hpp:72
uint64_t bind
Definition ChainedPointerAnalysis.hpp:71
uint64_t next
Definition ChainedPointerAnalysis.hpp:70
uint64_t key
Definition ChainedPointerAnalysis.hpp:69
uint64_t addr_div
Definition ChainedPointerAnalysis.hpp:68
uint64_t target
Definition ChainedPointerAnalysis.hpp:66
Definition ChainedPointerAnalysis.hpp:227
uint32_t target_seg_index
Definition ChainedPointerAnalysis.hpp:229
uint32_t target_seg_offset
Definition ChainedPointerAnalysis.hpp:228
uint32_t addr_div
Definition ChainedPointerAnalysis.hpp:231
uint32_t diversity
Definition ChainedPointerAnalysis.hpp:230
uint32_t auth
Definition ChainedPointerAnalysis.hpp:234
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_auth_segmented_rebase_t &chain)
uint32_t key
Definition ChainedPointerAnalysis.hpp:232
uint32_t next
Definition ChainedPointerAnalysis.hpp:233
Definition ChainedPointerAnalysis.hpp:113
uint64_t auth
Definition ChainedPointerAnalysis.hpp:119
uint64_t next
Definition ChainedPointerAnalysis.hpp:117
uint64_t zero
Definition ChainedPointerAnalysis.hpp:115
uint64_t ordinal
Definition ChainedPointerAnalysis.hpp:114
uint64_t addend
Definition ChainedPointerAnalysis.hpp:116
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_bind24_t &chain)
uint64_t bind
Definition ChainedPointerAnalysis.hpp:118
Definition ChainedPointerAnalysis.hpp:51
uint64_t bind
Definition ChainedPointerAnalysis.hpp:56
uint64_t ordinal
Definition ChainedPointerAnalysis.hpp:52
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_bind_t &chain)
uint64_t next
Definition ChainedPointerAnalysis.hpp:55
uint64_t zero
Definition ChainedPointerAnalysis.hpp:53
uint64_t auth
Definition ChainedPointerAnalysis.hpp:57
uint64_t addend
Definition ChainedPointerAnalysis.hpp:54
Definition ChainedPointerAnalysis.hpp:34
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_rebase_t &chain)
uint64_t next
Definition ChainedPointerAnalysis.hpp:37
uint64_t target
Definition ChainedPointerAnalysis.hpp:35
uint64_t bind
Definition ChainedPointerAnalysis.hpp:38
uint64_t auth
Definition ChainedPointerAnalysis.hpp:39
uint64_t unpack_target() const
Definition ChainedPointerAnalysis.hpp:44
uint64_t high8
Definition ChainedPointerAnalysis.hpp:36
Definition ChainedPointerAnalysis.hpp:214
friend std::ostream & operator<<(std::ostream &os, const dyld_chained_ptr_arm64e_segmented_rebase_t &chain)
uint32_t target_seg_offset
Definition ChainedPointerAnalysis.hpp:215
uint32_t next
Definition ChainedPointerAnalysis.hpp:218
uint32_t target_seg_index
Definition ChainedPointerAnalysis.hpp:216
uint32_t padding
Definition ChainedPointerAnalysis.hpp:217
uint32_t auth
Definition ChainedPointerAnalysis.hpp:219
Definition ChainedPointerAnalysis.hpp:429
dyld_chained_ptr_arm64e_bind24_t arm64e_bind24
Definition ChainedPointerAnalysis.hpp:437
dyld_chained_ptr_64_bind_t ptr_64_bind
Definition ChainedPointerAnalysis.hpp:439
dyld_chained_ptr_32_bind_t ptr_32_bind
Definition ChainedPointerAnalysis.hpp:442
dyld_chained_ptr_32_firmware_rebase_t ptr_32_firmware_rebase
Definition ChainedPointerAnalysis.hpp:444
dyld_chained_ptr_arm64e_auth_rebase_t arm64e_auth_rebase
Definition ChainedPointerAnalysis.hpp:434
PTR_TYPE type
Definition ChainedPointerAnalysis.hpp:430
dyld_chained_ptr_arm64e_rebase_t arm64e_rebase
Definition ChainedPointerAnalysis.hpp:432
uint64_t raw
Definition ChainedPointerAnalysis.hpp:448
dyld_chained_ptr_arm64e_segmented_rebase_t ptr_arm64e_segmented_rebase
Definition ChainedPointerAnalysis.hpp:446
dyld_chained_ptr_arm64e_auth_bind_t arm64e_auth_bind
Definition ChainedPointerAnalysis.hpp:435
dyld_chained_ptr_arm64e_auth_bind24_t arm64e_auth_bind24
Definition ChainedPointerAnalysis.hpp:438
dyld_chained_ptr_64_kernel_cache_rebase_t ptr_64_kernel_cache_rebase
Definition ChainedPointerAnalysis.hpp:440
dyld_chained_ptr_arm64e_bind_t arm64e_bind
Definition ChainedPointerAnalysis.hpp:433
dyld_chained_ptr_arm64e_auth_segmented_rebase_t ptr_arm64e_auth_segmented_rebase
Definition ChainedPointerAnalysis.hpp:447
dyld_chained_ptr_32_rebase_t ptr_32_rebase
Definition ChainedPointerAnalysis.hpp:441
dyld_chained_ptr_64_rebase_t ptr_64_rebase
Definition ChainedPointerAnalysis.hpp:436
friend std::ostream & operator<<(std::ostream &os, const union_pointer_t &ptr)
bool is_bind() const
Definition ChainedPointerAnalysis.hpp:455
dyld_chained_ptr_32_cache_rebase_t ptr_32_cache_rebase
Definition ChainedPointerAnalysis.hpp:443
result< uint64_t > target() const
result< uint32_t > ordinal() const
#define LIEF_API
Definition visibility.h:41