bata24 / gef

GEF - GDB Enhanced Features for exploit devs & reversers
Other
331 stars 23 forks source link

`heap` command failed after detach and attach new process #53

Closed Chovid99 closed 9 months ago

Chovid99 commented 9 months ago

Hi, I was currently playing around with your extension (which is super awesome), but I noticed small issues with it that I would like to report so that it can get better.

Let say that I start a new process A, and attach it to the current gdb session. If I detach, start a new process (B), and attach the new process, the heap command will be broken.

I suspect that there might be some cache not cleared during detaching a process, which caused the main_arena value is wrong. Step by step to reproduce:

Currently, the workaround is I need to do gef reload to reset it, but gef reload is quite slow. It would be great if this small issue can be fixed. Thanks a lot for creating this amazing extension!

bata24 commented 9 months ago

Thank you for the report. My debugging style is to quit and restart gdb each time, so I didn't notice this problem.

To fix the problem, I added processing to clear the heap_base cache and main_arena cache to reset_gef_cache. See: 44fb1bd0e5e12295df99b2dbdfe8138ba64024c0

Chovid99 commented 9 months ago

Thanks a lot for the quick response, I just tested it and it works perfectly! Really appreciate for the creation and maintenance of this awesome extension!