Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_core.h>
#include <rz_config.h>
#include <rz_types.h>
#include <math.h>
#include "core_private.h"
#include "linux_heap_glibc.h"
Go to the source code of this file.
Functions | |
static GHT GH() | get_va_symbol (RzCore *core, const char *path, const char *sym_name) |
Find the address of a given symbol. More... | |
static GHT GH() | align_address_to_size (ut64 addr, ut64 align) |
static GHT GH() | get_next_pointer (RzCore *core, GHT pos, GHT next) |
static GHT GH() | get_main_arena_with_symbol (RzCore *core, RzDebugMap *map) |
static bool GH() | is_tcache (RzCore *core) |
static GHT GH() | tcache_chunk_size (RzCore *core, GHT brk_start) |
static void GH() | update_arena_with_tc (GH(RzHeap_MallocState_tcache) *cmain_arena, MallocState *main_arena) |
static void GH() | update_arena_without_tc (GH(RzHeap_MallocState) *cmain_arena, MallocState *main_arena) |
RZ_API bool GH() | rz_heap_update_main_arena (RzCore *core, GHT m_arena, MallocState *main_arena) |
Store the MallocState struct of an arena with base address m_arena in main_arena. More... | |
static void GH() | get_brks (RzCore *core, GHT *brk_start, GHT *brk_end) |
static void GH() | print_arena_stats (RzCore *core, GHT m_arena, MallocState *main_arena, GHT global_max_fast, int format) |
RZ_API bool GH() | rz_heap_resolve_main_arena (RzCore *core, GHT *m_arena) |
Store the base address of main arena at m_arena. More... | |
void GH() | print_heap_chunk (RzCore *core, GHT chunk) |
RZ_API | GH (RzHeapChunk) |
Get a heap chunk with base address <addr> More... | |
void GH() | print_heap_chunk_simple (RzCore *core, GHT chunk, const char *status, PJ *pj) |
Prints compact representation of a heap chunk. Format: Chunk(addr=, size=, flags=) More... | |
static bool GH() | is_arena (RzCore *core, GHT m_arena, GHT m_state) |
static int GH() | print_double_linked_list_bin_simple (RzCore *core, GHT bin, MallocState *main_arena, GHT brk_start) |
static int GH() | print_double_linked_list_bin_graph (RzCore *core, GHT bin, MallocState *main_arena, GHT brk_start) |
static int GH() | print_double_linked_list_bin (RzCore *core, MallocState *main_arena, GHT m_arena, GHT offset, GHT num_bin, int graph) |
static void GH() | print_heap_bin (RzCore *core, GHT m_arena, MallocState *main_arena, const char *input) |
void GH() | rz_heap_chunk_free (RzHeapChunkListItem *item) |
RZ_API RzHeapBin *GH() | rz_heap_fastbin_content (RzCore *core, MallocState *main_arena, int bin_num) |
void GH() | print_heap_fastbin (RzCore *core, GHT m_arena, MallocState *main_arena, GHT global_max_fast, const char *input, bool main_arena_only, PJ *pj) |
static | GH (RTcache) |
RZ_API void GH() | tcache_free (GH(RTcache) *tcache) |
static bool GH() | tcache_read (RzCore *core, GHT tcache_start, GH(RTcache) *tcache) |
static int GH() | tcache_get_count (GH(RTcache) *tcache, int index) |
static GHT GH() | tcache_get_entry (GH(RTcache) *tcache, int index) |
RZ_API RzList *GH() | rz_heap_tcache_content (RzCore *core, GHT arena_base) |
Get a list of bins for the tcache associated with arena with base address arena_base. More... | |
static void GH() | print_tcache_content (RzCore *core, GHT arena_base, GHT main_arena_base, PJ *pj) |
void GH() | print_malloc_states (RzCore *core, GHT m_arena, MallocState *main_arena, bool json) |
void GH() | print_inst_minfo (GH(RzHeapInfo) *heap_info, GHT hinfo) |
void GH() | print_malloc_info (RzCore *core, GHT m_state, GHT malloc_state) |
char *GH() | rz_bin_num_to_type (int bin_num) |
RZ_API void GH() | rz_heap_bin_free (RzHeapBin *bin) |
RZ_API RzHeapBin *GH() | rz_heap_bin_content (RzCore *core, MallocState *main_arena, int bin_num, GHT m_arena) |
Get information about <bin_num> bin from NBINS array of an arena. More... | |
static int GH() | print_bin_content (RzCore *core, MallocState *main_arena, int bin_num, PJ *pj, GHT m_arena) |
Prints the heap chunks in a bin with double linked list (small|large|unsorted) More... | |
static void GH() | print_unsortedbin_description (RzCore *core, GHT m_arena, MallocState *main_arena, PJ *pj) |
Prints unsorted bin description for an arena (used for dmhd command) More... | |
static void GH() | print_smallbin_description (RzCore *core, GHT m_arena, MallocState *main_arena, PJ *pj) |
Prints small bins description for an arena (used for dmhd command) More... | |
static void GH() | print_largebin_description (RzCore *core, GHT m_arena, MallocState *main_arena, PJ *pj) |
Prints large bins description for an arena (used for dmhd command) More... | |
static void GH() | print_main_arena_bins (RzCore *core, GHT m_arena, MallocState *main_arena, GHT main_arena_base, GHT global_max_fast, RzHeapBinType format, bool json) |
Prints description of bins for main arena for dmhd command. More... | |
void GH() | rz_arena_list_free (RzArenaListItem *item) |
RZ_API RzList *GH() | rz_heap_arenas_list (RzCore *core, GHT m_arena, MallocState *main_arena) |
Get a list of MallocState structs for all the arenas. More... | |
RZ_API RzList *GH() | rz_heap_chunks_list (RzCore *core, MallocState *main_arena, GHT m_arena, GHT m_state, bool top_chunk) |
Get a list of all the heap chunks in an arena. The chunks are in form of a struct RzHeapChunkListItem. More... | |
RZ_IPI RzCmdStatus GH() | rz_cmd_arena_print_handler (RzCore *core, int argc, const char **argv) |
RZ_IPI RzCmdStatus GH() | rz_cmd_heap_chunks_print_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) |
RZ_IPI RzCmdStatus GH() | rz_cmd_main_arena_print_handler (RzCore *core, int argc, const char **argv, RzOutputMode mode) |
RZ_IPI RzCmdStatus GH() | rz_cmd_heap_chunk_print_handler (RzCore *core, int argc, const char **argv) |
RZ_IPI RzCmdStatus GH() | rz_cmd_heap_info_print_handler (RzCore *core, int argc, const char **argv) |
RZ_IPI RzCmdStatus GH() | rz_cmd_heap_tcache_print_handler (RzCore *core, int argc, const char **argv) |
RZ_IPI int GH() | rz_cmd_heap_bins_list_print (RzCore *core, const char *input) |
RZ_IPI int GH() | rz_cmd_heap_fastbins_print (void *data, const char *input) |
RZ_IPI RzCmdStatus GH() | rz_cmd_heap_arena_bins_print_handler (RzCore *core, int argc, const char **argv, RzOutputMode mode) |
RZ_API RzList *GH() | rz_heap_arena_list_wrapper (RzCore *core) |
A wrapper around GH(rz_heap_arenas_list) which handles finding main_arena. More... | |
RZ_API RzList *GH() | rz_heap_chunks_list_wrapper (RzCore *core, ut64 m_state) |
A wrapper around GH(rz_heap_chunks_list) which handles finding the main arena. More... | |
RZ_API RzHeapChunkSimple *GH() | rz_heap_chunk_wrapper (RzCore *core, GHT addr) |
Get info about a heap chunk as RzHeapChunkSimple. More... | |
RZ_API MallocState *GH() | rz_heap_get_arena (RzCore *core, GHT m_state) |
Get MallocState struct for arena with given base address if base address is 0 then return MallocState for main arena. More... | |
RZ_API bool GH() | rz_heap_write_heap_chunk (RzCore *core, RzHeapChunkSimple *chunk_simple) |
Write a heap chunk header to memory. More... | |
Definition at line 61 of file linux_heap_glibc.c.
References addr.
Referenced by get_main_arena_with_symbol().
Definition at line 221 of file linux_heap_glibc.c.
References map(), maps(), rz_config_get_b(), rz_debug_map_sync(), rz_io_maps(), and rz_pvector_foreach.
Referenced by print_double_linked_list_bin(), rz_cmd_heap_chunks_print_handler(), rz_heap_bin_content(), rz_heap_chunks_list(), rz_heap_fastbin_content(), rz_heap_resolve_main_arena(), and rz_heap_tcache_content().
|
static |
Definition at line 69 of file linux_heap_glibc.c.
References align_address_to_size(), rz_bin_info_t::arch, free(), get_va_symbol(), GH(), GHT, GHT_MAX, info(), map(), path, rz_bin_get_info(), rz_file_exists(), rz_return_val_if_fail, and strdup().
Referenced by rz_heap_resolve_main_arena().
Definition at line 65 of file linux_heap_glibc.c.
Referenced by rz_heap_chunks_list(), rz_heap_fastbin_content(), and rz_heap_tcache_content().
Find the address of a given symbol.
core | RzCore Pointer to the Rizin's core |
path | Pointer to the binary path in which to look for the symbol |
sym_name | Pointer to the symbol's name to search for |
Used to find the address of a given symbol inside a binary
TODO: Stop using deprecated functions like rz_bin_cur
Definition at line 30 of file linux_heap_glibc.c.
References GHT, GHT_MAX, path, rz_bin_cur(), rz_bin_file_delete(), rz_bin_file_set_cur_binfile(), rz_bin_get_symbols(), rz_bin_open(), rz_bin_options_init(), rz_config_get_b(), and s.
Referenced by get_main_arena_with_symbol().
|
static |
Definition at line 1012 of file linux_heap_glibc.c.
References GH(), NEW, NULL, OLD, RZ_NEW0, rz_return_val_if_fail, and TCACHE_NEW_VERSION.
RZ_API GH | ( | RzHeapChunk | ) |
Get a heap chunk with base address <addr>
core | RzCore pointer |
addr | Base address of the chunk |
Definition at line 558 of file linux_heap_glibc.c.
References addr, NULL, rz_io_nread_at(), and RZ_NEW0.
Referenced by get_main_arena_with_symbol(), GH(), is_arena(), print_bin_content(), print_double_linked_list_bin(), print_double_linked_list_bin_graph(), print_double_linked_list_bin_simple(), print_heap_bin(), print_heap_chunk(), print_heap_chunk_simple(), print_heap_fastbin(), print_largebin_description(), print_main_arena_bins(), print_malloc_info(), print_malloc_states(), print_smallbin_description(), print_tcache_content(), print_unsortedbin_description(), rz_cmd_arena_print_handler(), rz_cmd_heap_arena_bins_print_handler(), rz_cmd_heap_bins_list_print(), rz_cmd_heap_chunk_print_handler(), rz_cmd_heap_chunks_print_handler(), rz_cmd_heap_fastbins_print(), rz_cmd_heap_info_print_handler(), rz_cmd_heap_tcache_print_handler(), rz_cmd_main_arena_print_handler(), rz_heap_arena_list_wrapper(), rz_heap_arenas_list(), rz_heap_bin_content(), rz_heap_chunk_wrapper(), rz_heap_chunks_list(), rz_heap_chunks_list_wrapper(), rz_heap_fastbin_content(), rz_heap_get_arena(), rz_heap_resolve_main_arena(), rz_heap_tcache_content(), rz_heap_update_main_arena(), rz_heap_write_heap_chunk(), tcache_chunk_size(), and tcache_read().
Definition at line 630 of file linux_heap_glibc.c.
References free(), GH(), GHT_MAX, rz_malloc_state::next, rz_heap_update_main_arena(), and RZ_NEW0.
Referenced by print_malloc_info(), print_malloc_states(), rz_cmd_heap_arena_bins_print_handler(), rz_cmd_heap_bins_list_print(), rz_cmd_heap_chunks_print_handler(), rz_cmd_heap_fastbins_print(), rz_cmd_heap_info_print_handler(), rz_cmd_main_arena_print_handler(), rz_heap_arenas_list(), rz_heap_chunks_list_wrapper(), and rz_heap_get_arena().
Definition at line 98 of file linux_heap_glibc.c.
References eprintf, int, map(), NULL, rz_config_get_b(), rz_config_get_i(), rz_debug_map_sync(), rz_num_get_float(), and v.
Referenced by rz_heap_resolve_main_arena().
|
static |
Definition at line 251 of file linux_heap_glibc.c.
References addr, BINMAPSIZE, rz_cons_t::context, FASTBIN_IDX_TO_SIZE, GHT, i, int, k, largebin_index, NBINS, NFASTBINS, NSMALLBINS, rz_cons_context_t::pal, PFMT64d, PFMT64x, PRINT_BA, PRINT_GA, PRINTF_BA, PRINTF_GA, PRINTF_RA, PRINTF_YA, rz_config_get_i(), rz_cons_newline(), rz_cons_printf(), rz_cons_singleton(), rz_num_units(), RZ_OUTPUT_MODE_RIZIN, start, SZ, and ut64().
Referenced by rz_cmd_main_arena_print_handler().
|
static |
Prints the heap chunks in a bin with double linked list (small|large|unsorted)
core | RzCore pointer |
main_arena | MallocState struct for the arena in which bins are |
bin_num | The bin number for the bin from which chunks have to printed |
Definition at line 1487 of file linux_heap_glibc.c.
References rz_cons_t::context, bin::fd, GH(), NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_ka(), pj_kn(), pos, print_heap_chunk_simple(), PRINTF_BA, PRINTF_RA, PRINTF_YA, rz_cons_newline(), rz_cons_printf(), rz_cons_singleton(), rz_heap_bin_content(), rz_heap_bin_free(), and rz_list_length().
Referenced by print_largebin_description(), print_smallbin_description(), and print_unsortedbin_description().
|
static |
Definition at line 764 of file linux_heap_glibc.c.
References rz_cons_t::context, eprintf, get_brks(), GH(), GHT, GHT_MAX, NBINS, NSMALLBINS, rz_cons_context_t::pal, print_double_linked_list_bin_graph(), print_double_linked_list_bin_simple(), PRINT_GA, rz_config_get_i(), rz_cons_singleton(), and SZ.
Referenced by print_heap_bin().
|
static |
Definition at line 714 of file linux_heap_glibc.c.
References rz_cons_t::context, free(), g, GH(), GHT, GHT_MAX, NULL, rz_cons_context_t::pal, PFMT64x, PRINT_RA, rz_agraph_add_edge(), rz_agraph_add_node(), rz_agraph_free(), rz_agraph_new(), rz_agraph_print(), rz_config_get_i(), rz_cons_canvas_new(), rz_cons_singleton(), rz_io_read_at(), RZ_NEW0, snprintf, and ut64().
Referenced by print_double_linked_list_bin().
|
static |
Definition at line 660 of file linux_heap_glibc.c.
References rz_cons_t::context, free(), GH(), GHT, GHT_MAX, rz_cons_context_t::pal, PFMT64x, PRINT_RA, PRINTF_BA, PRINTF_GA, rz_cons_singleton(), rz_io_read_at(), RZ_NEW0, and ut64().
Referenced by print_double_linked_list_bin().
|
static |
Definition at line 815 of file linux_heap_glibc.c.
References rz_cons_t::context, eprintf, GH(), GHT, GHT_MAX, i, input(), int, NBINS, NULL, rz_cons_context_t::pal, PFMT64u, print_double_linked_list_bin(), PRINT_YA, PRINTF_YA, rz_config_get_i(), rz_cons_singleton(), rz_num_get(), SZ, and ut64().
Referenced by rz_cmd_heap_bins_list_print().
Definition at line 499 of file linux_heap_glibc.c.
References calloc(), rz_cons_t::context, free(), GH(), GHT, IS_MMAPPED, NON_MAIN_ARENA, rz_cons_context_t::pal, PFMT64u, PFMT64x, PREV_INUSE, PRINT_GA, PRINTF_BA, rz_cons_singleton(), rz_core_print_hexdump(), rz_io_read_at(), RZ_NEW0, SZ, and ut64().
Referenced by rz_cmd_heap_chunk_print_handler().
Prints compact representation of a heap chunk. Format: Chunk(addr=, size=, flags=)
core | RzCore pointer |
chunk | Offset of the chunk in memory |
Definition at line 572 of file linux_heap_glibc.c.
References rz_cons_t::context, free(), GH(), IS_MMAPPED, NON_MAIN_ARENA, NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_kn(), pj_o(), PREV_INUSE, PRINT_GA, PRINT_RA, PRINTF_BA, PRINTF_GA, PRINTF_YA, rz_cons_printf(), rz_cons_singleton(), status, and ut64().
Referenced by print_bin_content(), print_heap_fastbin(), print_tcache_content(), and rz_cmd_heap_chunks_print_handler().
void GH() print_heap_fastbin | ( | RzCore * | core, |
GHT | m_arena, | ||
MallocState * | main_arena, | ||
GHT | global_max_fast, | ||
const char * | input, | ||
bool | main_arena_only, | ||
PJ * | pj | ||
) |
Definition at line 942 of file linux_heap_glibc.c.
References rz_cons_t::context, eprintf, fastbin_index, GH(), i, input(), int, NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_ka(), pj_kn(), pj_ks(), pj_o(), pos, print_heap_chunk_simple(), PRINT_RA, PRINTF_BA, PRINTF_RA, PRINTF_YA, rz_config_get_i(), rz_cons_newline(), rz_cons_printf(), rz_cons_singleton(), rz_heap_bin_free(), rz_heap_fastbin_content(), rz_list_length(), rz_num_get(), and ut64().
Referenced by print_main_arena_bins(), and rz_cmd_heap_fastbins_print().
Definition at line 1320 of file linux_heap_glibc.c.
References rz_cons_t::context, rz_cons_context_t::pal, PFMT64x, PRINT_YA, PRINTF_BA, rz_cons_singleton(), and ut64().
Referenced by print_malloc_info().
|
static |
Prints large bins description for an arena (used for dmhd
command)
core | RzCore pointer |
m_arena | Offset of the arena in memory |
main_arena | Pointer to MallocState struct for the arena in which bins are |
Definition at line 1607 of file linux_heap_glibc.c.
References rz_cons_t::context, GH(), NBINS, NSMALLBINS, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_kn(), pj_ks(), pj_o(), print_bin_content(), PRINTF_YA, rz_cons_printf(), rz_cons_singleton(), and ut64().
Referenced by print_main_arena_bins().
|
static |
Prints description of bins for main arena for dmhd
command.
core | RzCore pointer |
m_arena | Offset of main arena in memory |
main_arena | Pointer to Malloc state struct for main arena |
global_max_fast | The largest fast bin size |
format | Enum to determine which type of bins to print. |
Definition at line 1643 of file linux_heap_glibc.c.
References free(), GH(), input(), NULL, pj_end(), pj_free(), pj_ka(), pj_new(), pj_o(), pj_string(), print_heap_fastbin(), print_largebin_description(), print_smallbin_description(), print_tcache_content(), print_unsortedbin_description(), rz_cons_newline(), rz_cons_println(), RZ_HEAP_BIN_ANY, RZ_HEAP_BIN_FAST, RZ_HEAP_BIN_LARGE, RZ_HEAP_BIN_SMALL, RZ_HEAP_BIN_TCACHE, RZ_HEAP_BIN_UNSORTED, rz_return_if_fail, and rz_str_newlen().
Referenced by rz_cmd_heap_arena_bins_print_handler().
Definition at line 1336 of file linux_heap_glibc.c.
References rz_cons_t::context, free(), GH(), GHT, GHT_MAX, is_arena(), rz_cons_context_t::pal, print_inst_minfo(), PRINT_RA, rz_cons_singleton(), rz_heap_update_main_arena(), rz_io_read_at(), RZ_NEW0, and rz_malloc_state::top.
Referenced by rz_cmd_heap_info_print_handler().
void GH() print_malloc_states | ( | RzCore * | core, |
GHT | m_arena, | ||
MallocState * | main_arena, | ||
bool | json | ||
) |
Definition at line 1238 of file linux_heap_glibc.c.
References rz_malloc_state::attached_threads, rz_cons_t::context, test_evm::end, free(), GH(), is_arena(), rz_malloc_state::last_remainder, rz_malloc_state::next, NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_free(), pj_ka(), pj_kn(), pj_ks(), pj_new(), pj_o(), pj_string(), PRINTF_YA, rz_cons_printf(), rz_cons_println(), rz_cons_singleton(), rz_heap_update_main_arena(), RZ_NEW0, rz_malloc_state::top, and ut64().
|
static |
Prints small bins description for an arena (used for dmhd
command)
core | RzCore pointer |
m_arena | Offset of the arena in memory |
main_arena | Pointer to MallocState struct for the arena in which bins are |
Definition at line 1573 of file linux_heap_glibc.c.
References rz_cons_t::context, GH(), NSMALLBINS, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_kn(), pj_ks(), pj_o(), print_bin_content(), PRINTF_YA, rz_cons_printf(), rz_cons_singleton(), and ut64().
Referenced by print_main_arena_bins().
|
static |
Definition at line 1177 of file linux_heap_glibc.c.
References bins, rz_cons_t::context, GH(), NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_ka(), pj_kn(), pj_ks(), pj_o(), pos, print_heap_chunk_simple(), PRINTF_BA, PRINTF_RA, PRINTF_YA, rz_cons_newline(), rz_cons_printf(), rz_cons_singleton(), rz_heap_tcache_content(), rz_list_free(), rz_list_length(), and ut64().
Referenced by print_main_arena_bins(), and rz_cmd_heap_tcache_print_handler().
|
static |
Prints unsorted bin description for an arena (used for dmhd
command)
core | RzCore pointer |
m_arena | Offset of the arena in memory |
main_arena | MallocState struct for the arena in which bin are |
Definition at line 1548 of file linux_heap_glibc.c.
References rz_cons_t::context, GH(), rz_cons_context_t::pal, PFMT64x, pj_end(), pj_kn(), pj_ks(), pj_o(), print_bin_content(), PRINTF_YA, rz_cons_printf(), rz_cons_singleton(), and ut64().
Referenced by print_main_arena_bins().
void GH() rz_arena_list_free | ( | RzArenaListItem * | item | ) |
Definition at line 1690 of file linux_heap_glibc.c.
References free().
Referenced by rz_heap_arenas_list().
Definition at line 1377 of file linux_heap_glibc.c.
References NBINS, NSMALLBINS, NULL, and rz_str_new().
Referenced by rz_heap_bin_content().
Definition at line 1961 of file linux_heap_glibc.c.
References argv, rz_malloc_state::attached_threads, call_handler, rz_cons_t::context, free(), GH(), GHT, GHT_MAX, rz_malloc_state::last_remainder, rz_malloc_state::next, rz_cons_context_t::pal, PFMT64x, pos, PRINTF_YA, rz_cmd_arena_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_cons_singleton(), rz_heap_arenas_list(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), rz_list_free(), RZ_NEW0, rz_malloc_state::top, and ut64().
Referenced by rzshell_cmddescs_init().
RZ_IPI RzCmdStatus GH() rz_cmd_heap_arena_bins_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv, | ||
RzOutputMode | mode | ||
) |
Definition at line 2376 of file linux_heap_glibc.c.
References argv, call_handler, rz_cons_t::context, free(), GH(), GHT, GHT_MAX, input(), is_arena(), rz_cons_context_t::pal, print_main_arena_bins(), PRINT_RA, rz_cmd_heap_arena_bins_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_singleton(), RZ_HEAP_BIN_ANY, RZ_HEAP_BIN_FAST, RZ_HEAP_BIN_LARGE, RZ_HEAP_BIN_SMALL, RZ_HEAP_BIN_TCACHE, RZ_HEAP_BIN_UNSORTED, rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), RZ_NEW0, RZ_OUTPUT_MODE_JSON, and SZ.
Referenced by rzshell_cmddescs_init().
Definition at line 2289 of file linux_heap_glibc.c.
References rz_cons_t::context, dup, free(), GH(), GHT, GHT_MAX, input(), is_arena(), NULL, rz_cons_context_t::pal, print_heap_bin(), PRINT_RA, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_singleton(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), RZ_NEW0, rz_num_get(), and strdup().
RZ_IPI RzCmdStatus GH() rz_cmd_heap_chunk_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv | ||
) |
Definition at line 2207 of file linux_heap_glibc.c.
References addr, argv, call_handler, free(), GH(), GHT, GHT_MAX, print_heap_chunk(), rz_cmd_heap_chunk_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_heap_resolve_main_arena(), RZ_NEW0, and ut64().
Referenced by rzshell_cmddescs_init().
RZ_IPI RzCmdStatus GH() rz_cmd_heap_chunks_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv, | ||
RzCmdStateOutput * | state | ||
) |
Definition at line 2006 of file linux_heap_glibc.c.
References argv, call_handler, calloc(), rz_cons_canvas_t::color, rz_cons_t::context, test_evm::end, free(), g, get_brks(), GH(), GHT, GHT_MAX, h, is_arena(), rz_cons_canvas_t::linemode, NULL, rz_cons_context_t::pal, PFMT64x, pj_end(), pj_ka(), pj_kn(), pj_ks(), pj_o(), pos, print_heap_chunk_simple(), PRINT_RA, PRINTF_YA, rz_agraph_add_edge(), rz_agraph_add_node(), rz_agraph_new(), rz_agraph_print(), rz_agraph_set_title(), rz_cmd_heap_chunks_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get_i(), rz_config_hold_free(), rz_config_hold_new(), rz_config_hold_restore(), rz_cons_canvas_free(), rz_cons_canvas_new(), rz_cons_get_size(), rz_cons_newline(), rz_cons_printf(), rz_cons_singleton(), rz_core_print_hexdump(), RZ_EMPTY, rz_heap_chunks_list(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), rz_io_nread_at(), rz_list_free(), RZ_NEW0, rz_num_get(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG, RZ_OUTPUT_MODE_LONG_JSON, RZ_OUTPUT_MODE_RIZIN, RZ_OUTPUT_MODE_STANDARD, RZ_PRINT_FLAGS_HEADER, rz_str_new(), rz_str_newf(), rz_malloc_state::system_mem, SZ, rz_malloc_state::top, ut64(), and w.
Referenced by rzshell_cmddescs_init().
Definition at line 2331 of file linux_heap_glibc.c.
References call_handler, rz_cons_t::context, dup, free(), GH(), GHT, GHT_MAX, input(), is_arena(), NULL, rz_core_t::offset, rz_cons_context_t::pal, print_heap_fastbin(), PRINT_RA, rz_core_t::prompt_offset, rz_cmd_heap_fastbins_print(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_singleton(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), RZ_NEW0, rz_num_get(), strdup(), and SZ.
Referenced by rzshell_cmddescs_init().
RZ_IPI RzCmdStatus GH() rz_cmd_heap_info_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv | ||
) |
Definition at line 2224 of file linux_heap_glibc.c.
References argv, call_handler, rz_cons_t::context, free(), GH(), GHT, GHT_MAX, is_arena(), NULL, rz_cons_context_t::pal, print_malloc_info(), PRINT_RA, rz_cmd_heap_info_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_singleton(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), RZ_NEW0, and rz_num_get().
Referenced by rzshell_cmddescs_init().
RZ_IPI RzCmdStatus GH() rz_cmd_heap_tcache_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv | ||
) |
Definition at line 2255 of file linux_heap_glibc.c.
References rz_arena_list_item::addr, argv, call_handler, free(), GH(), GHT, GHT_MAX, NULL, print_tcache_content(), rz_cmd_heap_tcache_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get_i(), rz_cons_printf(), rz_heap_arenas_list(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), and RZ_NEW0.
Referenced by rzshell_cmddescs_init().
RZ_IPI RzCmdStatus GH() rz_cmd_main_arena_print_handler | ( | RzCore * | core, |
int | argc, | ||
const char ** | argv, | ||
RzOutputMode | mode | ||
) |
Definition at line 2175 of file linux_heap_glibc.c.
References argv, call_handler, rz_cons_t::context, free(), GH(), GHT, GHT_MAX, is_arena(), NULL, rz_cons_context_t::pal, print_arena_stats(), PRINT_RA, rz_cmd_main_arena_print_handler(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_singleton(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), RZ_NEW0, rz_num_get(), and SZ.
Referenced by rzshell_cmddescs_init().
A wrapper around GH(rz_heap_arenas_list) which handles finding main_arena.
core | RzCore pointer |
Definition at line 2433 of file linux_heap_glibc.c.
References free(), GH(), GHT, rz_heap_arenas_list(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), rz_list_newf(), and RZ_NEW0.
Referenced by rz_heap_arenas_list().
Get a list of MallocState structs for all the arenas.
core | RzCore pointer |
m_arena | Base address of MallocState struct of main arena |
main_arena | MallocState struct of main arena |
Definition at line 1702 of file linux_heap_glibc.c.
References rz_arena_list_item::addr, rz_arena_list_item::arena, free(), GH(), is_arena(), rz_malloc_state::next, rz_arena_list_free(), rz_heap_update_main_arena(), rz_list_append(), rz_list_newf(), RZ_NEW0, rz_str_new(), rz_arena_list_item::type, and ut64().
Referenced by rz_cmd_arena_print_handler(), rz_cmd_heap_tcache_print_handler(), and rz_heap_arena_list_wrapper().
RZ_API RzHeapBin* GH() rz_heap_bin_content | ( | RzCore * | core, |
MallocState * | main_arena, | ||
int | bin_num, | ||
GHT | m_arena | ||
) |
Get information about <bin_num> bin from NBINS array of an arena.
core | RzCore pointer |
main_arena | MallocState struct of arena |
bin_num | bin number of bin whose chunk list you want |
Definition at line 1404 of file linux_heap_glibc.c.
References bin::fd, free(), get_brks(), GH(), GHT, GHT_MAX, test-lz4-versions::head, setup::idx, int, NULL, rz_bin_num_to_type(), rz_config_get_i(), rz_heap_bin_free(), rz_io_read_at(), rz_list_append(), rz_list_newf(), RZ_NEW0, rz_str_new(), SZ, and ut64().
Referenced by print_bin_content().
Definition at line 1388 of file linux_heap_glibc.c.
References free(), and rz_list_free().
Referenced by print_bin_content(), print_heap_fastbin(), rz_heap_bin_content(), and rz_heap_tcache_content().
void GH() rz_heap_chunk_free | ( | RzHeapChunkListItem * | item | ) |
Definition at line 854 of file linux_heap_glibc.c.
References free().
Referenced by rz_heap_chunks_list(), rz_heap_fastbin_content(), and rz_heap_tcache_content().
RZ_API RzHeapChunkSimple* GH() rz_heap_chunk_wrapper | ( | RzCore * | core, |
GHT | addr | ||
) |
Get info about a heap chunk as RzHeapChunkSimple.
core | RzCore pointer |
addr | Base address of the heap chunk |
Definition at line 2484 of file linux_heap_glibc.c.
References addr, rz_heap_chunk_simple::addr, rz_heap_chunk_simple::bk, rz_heap_chunk_simple::bk_nextsize, bool, rz_heap_chunk_simple::fd, rz_heap_chunk_simple::fd_nextsize, free(), GH(), IS_MMAPPED, rz_heap_chunk_simple::is_mmapped, NON_MAIN_ARENA, rz_heap_chunk_simple::non_main_arena, NULL, PREV_INUSE, rz_heap_chunk_simple::prev_inuse, rz_heap_chunk_simple::prev_size, RZ_NEW0, rz_heap_chunk_simple::size, and ut64().
Referenced by rz_heap_chunk(), and rz_heap_chunks_list().
RZ_API RzList* GH() rz_heap_chunks_list | ( | RzCore * | core, |
MallocState * | main_arena, | ||
GHT | m_arena, | ||
GHT | m_state, | ||
bool | top_chunk | ||
) |
Get a list of all the heap chunks in an arena. The chunks are in form of a struct RzHeapChunkListItem.
core | RzCore pointer |
main_arena | MallocState struct of main arena |
m_arena | Base address of malloc state of main arena |
m_state | Base address of malloc state of the arena whose chunks are required |
top_chunk | Boolean value to return the top chunk in the list or not |
Definition at line 1755 of file linux_heap_glibc.c.
References rz_heap_chunk_list_item::addr, rz_cons_t::context, count, eprintf, free(), get_brks(), get_next_pointer(), GH(), GHT, GHT_MAX, i, setup::idx, min_size, MMAP_OFFSET, n, rz_cons_context_t::pal, PRINT_RA, r, read_le, rz_config_get_b(), rz_config_get_i(), rz_cons_singleton(), rz_heap_chunk_free(), rz_heap_chunk_wrapper(), rz_io_read_at(), rz_list_append(), rz_list_newf(), RZ_NEW0, rz_str_new(), rz_heap_chunk_list_item::size, rz_heap_chunk_simple::size, rz_heap_chunk_list_item::status, status, SZ, TC_HDR_SZ, tcache_free(), tcache_get_count(), tcache_get_entry(), TCACHE_MAX_BINS, tcache_read(), and ut64().
Referenced by rz_cmd_heap_chunks_print_handler(), and rz_heap_chunks_list_wrapper().
A wrapper around GH(rz_heap_chunks_list) which handles finding the main arena.
core | RzCore pointer |
m_arena | Base Address of the arena |
Definition at line 2457 of file linux_heap_glibc.c.
References free(), GH(), GHT, is_arena(), rz_heap_chunks_list(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), rz_list_newf(), and RZ_NEW0.
Referenced by rz_heap_chunks_list().
RZ_API RzHeapBin* GH() rz_heap_fastbin_content | ( | RzCore * | core, |
MallocState * | main_arena, | ||
int | bin_num | ||
) |
Definition at line 862 of file linux_heap_glibc.c.
References rz_heap_chunk_list_item::addr, rz_heap_bin::bin_num, rz_heap_bin::chunks, FASTBIN_IDX_TO_SIZE, rz_heap_bin::fd, free(), get_brks(), get_next_pointer(), GH(), GHT, GHT_MAX, rz_heap_bin::message, message, NULL, PFMT64x, rz_heap_chunk_free(), rz_io_read_at(), rz_list_append(), rz_list_newf(), RZ_NEW0, rz_snprintf(), rz_str_new(), rz_heap_bin::size, rz_heap_chunk_list_item::status, rz_heap_bin::type, and ut64().
Referenced by print_heap_fastbin().
RZ_API MallocState* GH() rz_heap_get_arena | ( | RzCore * | core, |
GHT | m_state | ||
) |
Get MallocState struct for arena with given base address if base address is 0 then return MallocState for main arena.
core | RzCore pointer |
addr | Base address of the arena |
Definition at line 2516 of file linux_heap_glibc.c.
References free(), GH(), GHT, is_arena(), NULL, rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), and RZ_NEW0.
Store the base address of main arena at m_arena.
core | RzCore pointer |
m_arena | Store the location of main arena at this integer pointer |
Definition at line 408 of file linux_heap_glibc.c.
References eprintf, free(), get_brks(), get_main_arena_with_symbol(), GH(), GHT, GHT_MAX, is_tcache(), map(), maps(), rz_config_get_b(), rz_config_set_i(), rz_debug_map_sync(), rz_heap_update_main_arena(), rz_io_maps(), RZ_NEW0, RZ_PERM_RW, rz_pvector_foreach, rz_return_val_if_fail, rz_malloc_state::system_mem, and rz_malloc_state::top.
Referenced by rz_cmd_arena_print_handler(), rz_cmd_heap_arena_bins_print_handler(), rz_cmd_heap_bins_list_print(), rz_cmd_heap_chunk_print_handler(), rz_cmd_heap_chunks_print_handler(), rz_cmd_heap_fastbins_print(), rz_cmd_heap_info_print_handler(), rz_cmd_heap_tcache_print_handler(), rz_cmd_main_arena_print_handler(), rz_heap_arena_list_wrapper(), rz_heap_chunks_list_wrapper(), rz_heap_get_arena(), and rz_heap_tcache_content().
Get a list of bins for the tcache associated with arena with base address arena_base.
core | RzCore pointer |
arena_base | Base address of the arena |
Definition at line 1063 of file linux_heap_glibc.c.
References rz_malloc_state::attached_threads, count, error(), bin::fd, free(), get_brks(), get_next_pointer(), GH(), GHT, GHT_MAX, i, n, NULL, r, rz_config_get_i(), rz_cons_printf(), rz_heap_bin_free(), rz_heap_chunk_free(), rz_heap_resolve_main_arena(), rz_heap_update_main_arena(), rz_io_nread_at(), rz_list_append(), rz_list_free(), rz_list_newf(), RZ_NEW0, rz_str_new(), tcache_chunk_size(), tcache_free(), tcache_get_count(), tcache_get_entry(), TCACHE_MAX_BINS, tcache_read(), and ut64().
Referenced by print_tcache_content().
Store the MallocState struct of an arena with base address m_arena in main_arena.
core | RzCore pointer |
m_arena | The base address of malloc state struct of the arena |
main_arena | The MallocState struct in which the data is stored |
Definition at line 199 of file linux_heap_glibc.c.
References GH(), rz_config_get_i(), rz_io_read_at(), RZ_NEW0, update_arena_with_tc(), and update_arena_without_tc().
Referenced by is_arena(), print_malloc_info(), print_malloc_states(), rz_cmd_arena_print_handler(), rz_cmd_heap_arena_bins_print_handler(), rz_cmd_heap_bins_list_print(), rz_cmd_heap_chunks_print_handler(), rz_cmd_heap_fastbins_print(), rz_cmd_heap_info_print_handler(), rz_cmd_heap_tcache_print_handler(), rz_cmd_main_arena_print_handler(), rz_heap_arena_list_wrapper(), rz_heap_arenas_list(), rz_heap_chunks_list_wrapper(), rz_heap_get_arena(), rz_heap_resolve_main_arena(), and rz_heap_tcache_content().
RZ_API bool GH() rz_heap_write_heap_chunk | ( | RzCore * | core, |
RzHeapChunkSimple * | chunk_simple | ||
) |
Write a heap chunk header to memory.
core | RzCore pointer |
chunk_simple | RzHeapChunkSimple pointer to the heap chunk data |
Definition at line 2544 of file linux_heap_glibc.c.
References free(), GH(), IS_MMAPPED, NON_MAIN_ARENA, PREV_INUSE, rz_io_write_at(), and RZ_NEW0.
Referenced by rz_heap_write_chunk().
Definition at line 135 of file linux_heap_glibc.c.
References GH(), GHT, rz_io_read_at(), and RZ_NEW0.
Referenced by rz_heap_tcache_content().
Definition at line 1028 of file linux_heap_glibc.c.
References free(), NEW, and rz_return_if_fail.
Referenced by rz_heap_chunks_list(), and rz_heap_tcache_content().
Definition at line 1043 of file linux_heap_glibc.c.
References NEW, and rz_return_val_if_fail.
Referenced by rz_heap_chunks_list(), and rz_heap_tcache_content().
Definition at line 1050 of file linux_heap_glibc.c.
References NEW, and rz_return_val_if_fail.
Referenced by rz_heap_chunks_list(), and rz_heap_tcache_content().
Definition at line 1036 of file linux_heap_glibc.c.
References GH(), NEW, rz_io_read_at(), and rz_return_val_if_fail.
Referenced by rz_heap_chunks_list(), and rz_heap_tcache_content().
|
static |
Definition at line 147 of file linux_heap_glibc.c.
References BINMAPSIZE, i, NBINS, and NFASTBINS.
Referenced by rz_heap_update_main_arena().
|
static |
Definition at line 170 of file linux_heap_glibc.c.
References BINMAPSIZE, i, NBINS, and NFASTBINS.
Referenced by rz_heap_update_main_arena().