linux_heap_glibc: refactor (#11541)

This commit is contained in:
morbith-dqtz 2018-09-17 02:00:39 +02:00 committed by radare
parent 94c4c0ca28
commit 5c6b976343
4 changed files with 515 additions and 788 deletions

View File

@ -1186,8 +1186,8 @@ int main(int argc, char **argv, char **envp) {
#if __linux__ && __GNU_LIBRARY__ && __GLIBC__ && __GLIBC_MINOR__ && __x86_64__
ut64 bitness = r_config_get_i (r.config, "asm.bits");
if (bitness == 32) {
eprintf ("glibc.fc_offset = 0x00158\n");
r_config_set_i (r.config, "dbg.glibc.fc_offset", 0x00158);
eprintf ("glibc.fc_offset = 0x00148\n");
r_config_set_i (r.config, "dbg.glibc.fc_offset", 0x00148);
}
#endif
}

View File

@ -2397,10 +2397,10 @@ R_API int r_core_config_init(RCore *core) {
#endif
#if __x86_64__
SETI ("dbg.glibc.ma_offset", 0x000000, "Main_arena offset from his symbol");
SETI ("dbg.glibc.fc_offset", 0x00250, "First chunk offset from brk_start");
SETI ("dbg.glibc.fc_offset", 0x00240, "First chunk offset from brk_start");
#else
SETI ("dbg.glibc.ma_offset", 0x1bb000, "Main_arena offset from his symbol");
SETI ("dbg.glibc.fc_offset", 0x158, "First chunk offset from brk_start");
SETI ("dbg.glibc.fc_offset", 0x148, "First chunk offset from brk_start");
#endif
SETPREF ("dbg.libc.dbglib", "", "Set libc debug library file");

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,16 @@ R_LIB_VERSION_HEADER(r_heap_glibc);
#define TCACHE_MAX_BINS 64
#define TCACHE_FILL_COUNT 7
#define MMAP_ALIGN_32 0x14
#define MMAP_ALIGN_64 0x18
#define MMAP_OFFSET 0x8
#define HDR_SZ_32 0x8
#define HDR_SZ_64 0x10
#define TC_HDR_SZ 0x10
#define TC_SZ_32 0x0
#define TC_SZ_64 0x10
#define largebin_index_32(size) \
(((((ut32)(size)) >> 6) <= 38)? 56 + (((ut32)(size)) >> 6): \
((((ut32)(size)) >> 9) <= 20)? 91 + (((ut32)(size)) >> 9): \
@ -130,12 +140,12 @@ typedef struct r_malloc_state_64 {
typedef struct r_tcache_perthread_struct_32 {
ut8 counts[TCACHE_MAX_BINS];
unsigned int *entries[TCACHE_MAX_BINS];
ut32 entries[TCACHE_MAX_BINS];
} RHeapTcache_32;
typedef struct r_tcache_perthread_struct_64 {
ut8 counts[TCACHE_MAX_BINS];
unsigned int *entries[TCACHE_MAX_BINS];
ut64 entries[TCACHE_MAX_BINS];
} RHeapTcache_64;
typedef struct r_malloc_state_tcache_32 {