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: prepare for libkdumpfile-0.5.5 #452

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Conversation

ptesarik
Copy link
Contributor

@ptesarik ptesarik commented Dec 3, 2024

Adapt to libkdumpfile attribute lifetime fixes.

Since libkdumpfile commit 5b044292abe9 ("Clarify and fix attribute data
lifetime") changes the lifetime of attribute values retrieved with
kdump_attr_ref_get(), the extra reference would keep the PRSTATUS blob
around even after kdump_free().

However, the attribute hierarchy cannot change while iterating over the
PRSTATUS attributes, so it is not necessary to take an attribute reference
and we can use kdump_get_typed_attr().

The attribute blob itself should not change either, but 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.

The blob pin does not prevent freeing the blob when the blob reference
count reaches zero.

Signed-off-by: Petr Tesarik <[email protected]>
The kdump_get_typed_attr() function prototype changed in libkdumpfile
commit e182aeaf4d72 ("Make kdump_get_typed_attr() easier to use").

Signed-off-by: Petr Tesarik <[email protected]>
@osandov osandov merged commit 4e06cfd into osandov:main Dec 19, 2024
34 checks passed
@osandov
Copy link
Owner

osandov commented Dec 19, 2024

Thanks! I was only able to test 0.5.4, but I'm taking your word for it on the upcoming 0.5.5.

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.

2 participants