-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
mallocng: Add ng-metaarea and ng-ctx commands #3164
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
Conversation
k4lizen
commented
Jul 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds two new commands to the mallocng debugging functionality: mallocng-meta-area (alias ng-metaarea) and mallocng-malloc-context (alias ng-ctx) for inspecting mallocng allocator structures. Additionally, it improves error handling in existing commands by properly checking the return value of init_if_needed().
Key changes include:
- Addition of two new commands with corresponding dump functions for detailed structure inspection
- Enhanced error handling for allocator initialization failures
- Code quality improvements with type annotations and minor refactoring
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pwndbg/commands/mallocng.py | Adds new commands and improves error handling for allocator initialization |
| pwndbg/aglib/heap/mallocng.py | Adds type annotations, refactors code, and enhances init_if_needed() return handling |
| docs/commands/musl/mallocng-meta-area.md | Documentation for the new mallocng-meta-area command |
| docs/commands/musl/mallocng-malloc-context.md | Documentation for the new mallocng-malloc-context command |
| docs/commands/index.md | Updates command index to include the new commands |
| if self.hope: | ||
| self.finished_init = True |
Copilot
AI
Jul 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is incorrect. This line and the following line should be dedented to align with the previous statements in the function.
| if self.hope: | |
| self.finished_init = True | |
| if self.hope: | |
| self.finished_init = True |
| self.finished_init = True | ||
| # We will try to reinitialize again if we failed now. | ||
| if self.hope: | ||
| self.finished_init = True |
Copilot
AI
Jul 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is incorrect. This line should be dedented to align with the previous statements in the function.
| self.finished_init = True | |
| self.finished_init = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the hell?
|
|
||
| for addr, mapname in possible: | ||
| if mapname.contains("libc"): | ||
| if "libc" in mapname: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fine? "libcrypto" will match here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I mean, this will only iterate over mappings that contain the AT_RANDOM+8 value, but I guess libcrypto might use this..
I'll check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't, should be good :>