Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chunk listing with tcache #16239

Merged
merged 2 commits into from
Mar 17, 2020
Merged

Fix chunk listing with tcache #16239

merged 2 commits into from
Mar 17, 2020

Conversation

x0urc3
Copy link
Contributor

@x0urc3 x0urc3 commented Mar 17, 2020

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the documentation and the radare2 book with the relevant information (if needed)

Detailed description

  • dmh was broken because it uses a hardcoded offset from dbg.glibc.fc_offset
  • This PR use tcache chunk size to find the next chunk
  • Please do not close yet. There are several other places that uses fc_offset that I would like to fix in this PR
$ grep -IR fc_offset libr/*
libr/core/cconfig.c:    SETI ("dbg.glibc.fc_offset", 0x00240, "First chunk offset from brk_start");
libr/core/cconfig.c:    SETI ("dbg.glibc.fc_offset", 0x148, "First chunk offset from brk_start");
libr/core/linux_heap_glibc.c:           const int fc_offset = r_config_get_i (core->config, "dbg.glibc.fc_offset");
libr/core/linux_heap_glibc.c:           initial_brk = ( (brk_start >> 12) << 12 ) + fc_offset;
libr/core/linux_heap_glibc.c:   const int offset = r_config_get_i (core->config, "dbg.glibc.fc_offset");
libr/core/linux_heap_glibc.c:   const int offset = r_config_get_i (core->config, "dbg.glibc.fc_offset");
libr/main/radare2.c:                                                    eprintf ("glibc.fc_offset = 0x00148\n");
libr/main/radare2.c:                                                    r_config_set_i (r->config, "dbg.glibc.fc_offset", 0x00148);

Test plan

  • A test has been added to count allocated chunk. Result has been compared with gdb-gef

Closing issues

Closes #16206

@radare radare merged commit 676cd8a into radareorg:master Mar 17, 2020
@x0urc3 x0urc3 deleted the fix-dmh branch March 17, 2020 13:35
@XVilka XVilka added the heap Parsing memory heap structures label Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
heap Parsing memory heap structures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting wrong heap info with 'dmh'
3 participants