-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Tcache parsing should be handled on per thread basis #1259
Comments
Some notes for this issueTcache implementation in malloc.c typedef struct tcache_perthread_struct
{
char counts[TCACHE_MAX_BINS];
tcache_entry *entries[TCACHE_MAX_BINS];
} tcache_perthread_struct;
static __thread bool tcache_shutting_down = false;
static __thread tcache_perthread_struct *tcache = NULL; The core issue here is to get the base address of How does
|
This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions. |
Is your feature request related to a problem? Please describe.
In Glibc heap, a different tcache is created per thread. Rizin uses Arenas to find and parse the tcaches. This consequently leads to Rizin not displaying all the tcaches (
dmht
command) when the number of threads is greater than the number of arenas i.e. multiple threads share an Arena.Here is an example binary:
The binary above spawns 100 threads (101 if you include main thread) and populates the tcache in each thread. The output for Rizin:
Rizin reports total 48 arenas which is accurate. (6 cores * 8)
Now output for
dmht
command:Rizin finds 141 chunks across 47 Tcache bins. (3 chunks per bins and 1 bin per thread).
This is incorrect as there were total 100 threads created and each thread would have its own tcache.
We can verify this using
dev
build of GEF which recently fixed an issue like this.Describe the solution you'd like
A GDB like output is expected where 100 populated tcache bins are found. Printing the thread ID instead of arena address also seems better to convey to the user that tcache belongs to threads not arenas.
As I am working on Cutter Heap Viewer at the moment, I would give this issue a try right now and resolve this before I refactor the tcache part and implement tcache in Cutter heap viewer.
The text was updated successfully, but these errors were encountered: