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

libdrgn: kdump: simplify getting the PRSTATUS attributes #451

Closed
wants to merge 1 commit into from

Conversation

ptesarik
Copy link
Contributor

@ptesarik ptesarik commented Dec 2, 2024

Since the attribute hierarchy cannot change while iterating over the PRSTATUS attributes, it is not necessary to take an attribute reference.

Although the attribute blob itself should not change either, it is a good idea to keep its data pinned, because a raw pointer to it is stored in the drgn_thread_set hash table. If some code tries to modify the PRSTATUS attribute data, the attempt will fail with KDUMP_ERR_BUSY rather than leave a dangling pointer in the hash table and possibly cause a UAF bug later.

Since the attribute hierarchy cannot change while iterating over the
PRSTATUS attributes, it is not necessary to take an attribute reference.

Although the attribute blob itself should not change either, it is a good
idea to keep its data pinned, because a raw pointer to it is stored in the
drgn_thread_set hash table. If some code tries to modify the PRSTATUS
attribute data, the attempt will fail with KDUMP_ERR_BUSY rather than leave
a dangling pointer in the hash table and possibly cause a UAF bug later.

Signed-off-by: Petr Tesarik <[email protected]>
@ptesarik
Copy link
Contributor Author

ptesarik commented Dec 2, 2024

Argh, scratch it. I thought I knew what I wanted with the reference counts, but it turns out I don't and I would cause regressions.

@ptesarik ptesarik closed this Dec 2, 2024
@ptesarik ptesarik deleted the kdump_attr branch December 2, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant