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

[Bug] heap chunks commands not working with GLIBC_TUNABLES set #935

Closed
4 of 9 tasks
theguy147 opened this issue Mar 15, 2023 · 1 comment
Closed
4 of 9 tasks

[Bug] heap chunks commands not working with GLIBC_TUNABLES set #935

theguy147 opened this issue Mar 15, 2023 · 1 comment

Comments

@theguy147
Copy link
Collaborator

theguy147 commented Mar 15, 2023

GEF+GDB version

GEF: rev:174830a86db426da9e63adc21d98199a3e370c84 (Git - clean)
SHA256(gef.py): 3d890c78a4ebc7a223b3e081111faf55c3d05e441c1284290f4e39758e5a64c5
GDB: 9.2
GDB-Python: 3.8

Operating System

Ubuntu 20.04.5 LTS

Describe the issue you encountered

The heap chunks command does not work properly when setting GLIBC_TUNABLES, e.g., glibc.malloc.tcache_count or glibc.malloc.arena_max when symbols ARE available for the linked glibc (the command works if the symbols are not available).

The reason for this is that GefHeapManager.base_address uses mp_->sbrk_base if symbols are available in the glibc to find the base address of the heap. This value does not point to the beginning of the heap section when some GLIBC_TUNABLES are set.

Do you read the docs and look at previously closed issues/PRs for similar cases?

Yes

Architecture impacted

  • X86
  • X64
  • ARM
  • ARM64
  • MIPS
  • MIPS64
  • PPC
  • PPC64
  • RISCV

Describe your issue. Without a proper reproduction step-by-step, your issue will be ignored.

  1. start GEF/GDB with e.g. the /tmp/heap-non-main.out binary from the test suite
  2. set exec-wrapper env GLIBC_TUNABLES=glibc.malloc.tcache_count=0
  3. run
  4. p mp_->sbrk_base

The last returned value from the above commands does not correspond to the output of vmmap heap.

Minimalist test case

See heap-non-main.c from the test suite

Additional context?

No response

@theguy147 theguy147 changed the title [Bug] [Bug] heap chunks commands not working with GLIBC_TUNABLES set Mar 15, 2023
@theguy147
Copy link
Collaborator Author

fixed in #936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant