-
Notifications
You must be signed in to change notification settings - Fork 853
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
Basic jemalloc command for printing arenas info with bin #2176
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Awesome! |
@jetchirag My jemalloc version is 5.3.0-182-gf9c0b5f7f8a917661db39289e38ec94d9d198f11 |
@CptGibbon Are you on dev branch? It was renamed, I'm using 5.3.0. Btw to update on progress, I'm currently working on parsing rtree which stores extent metadata, will add a command for that soon. |
I'm on the EDIT: Oh I guess you meant dev branch of jemalloc? |
The latest release, version 5.3.0. Edit: you can download it from https://github.com/jemalloc/jemalloc/releases/tag/5.3.0 |
Great stuff, just a couple of notes for this PR:
|
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
@CptGibbon Added prefixes to command, and also installation script. Also pushed some WIP code for rtree parsing. |
Okay thanks, great work 👍 |
I'm seeing a few lint commits, I find working in an IDE that supports devcontainers can alleviate this. |
…nd extent data Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
So I have removed the old commands and added proper class for generating memory mapping by jemalloc. There are lots of todos, I'll be adding one or two classes for rtree (including one to finding extent information from memory pointer address given by Things were slow past 2 weeks, I did read a lot of documentations on the same and will try to pick up pace now. Also, thank you for dev containers suggestion though seems like it didn't fix linting on |
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
@CptGibbon I think now we have something which resembles |
No problem, I'll review today. |
@jetchirag jemalloc_heap
find_extent
extent_infoUsed by the jemalloc_base_infoNo dice. get_extentNot sure if I'm using the correct address as an argument here but nothing I try works... jemalloc_testOne last note; if you want your test program to get linked with jemalloc you'll need to add a corresponding line to the makefile that builds tests. |
Thank you for testing @CptGibbon Your output for heap and find extent seems to be expected. Yes there are some false addresses, some of it seems to be due to cache_oblivious, I'll investigate that and add note in output if needed or fix it. Any comment on the code itself? |
I'm usually of the mind that if it works it works, but I can take a closer look 👍 So far my only concern aside from the address issue is that Great work 👌 |
Yes that has been my concern as well. I've mentioned this in comment, it's happening due to the size of rtree. I was trying to find it there's an alternate way, perhaps it maintains caches or thread specific information, will check. |
Just 1 note and 1 question: A current development goal is to uncouple as much code from the gdb library as possible, hopefully this makes testing easier and makes room for different debugger backends. One step towards this is pwndbg/pwndbg/gdblib/memory.py Lines 388 to 397 in f210003
Which will eventually become something like An example use can be found in The transition to debugger-agnostic code is still underway, so if using the above function would slow you down too much it's not a show-stopper, but it's something to consider. I see you credit jegdb in the source, which code specifically is taken from jegdb? |
@CptGibbon I'll check that function. I don't think there's much code taken directly from that script. The code for bit shifting bitfield was directly used and Primarily I used the script as base to correlate with jemalloc source code to understand structure. |
For #2174
First command for jemalloc to print basic arenas details, it is not modularized and currently only for basic testing purpose.