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: x86_64: allow phys_base to be 0 #457

Merged
merged 1 commit into from
Dec 18, 2024
Merged

libdrgn: x86_64: allow phys_base to be 0 #457

merged 1 commit into from
Dec 18, 2024

Conversation

osandov
Copy link
Owner

@osandov osandov commented Dec 18, 2024

Mark reported recursive address translation errors when debugging a QEMU guest memory dump. We're supposed to be handling this in linux_kernel_pgtable_iterator_next_x86_64() by translating swapper_pg_dir to a physical address. However, it decides whether phys_base was present in the VMCOREINFO by comparing phys_base to 0, and this dump legitimately had a phys_base of 0. Add a separate flag so we can distinguish missing vs 0.

@brenns10, mind sanity checking this?

Mark reported recursive address translation errors when debugging a QEMU
guest memory dump. We're supposed to be handling this in
linux_kernel_pgtable_iterator_next_x86_64() by translating
swapper_pg_dir to a physical address. However, it decides whether
phys_base was present in the VMCOREINFO by comparing phys_base to 0, and
this dump legitimately had a phys_base of 0. Add a separate flag so we
can distinguish missing vs 0.

Reported-and-tested-by: Mark Harmstone <[email protected]>
Fixes: 5b39bfb ("libdrgn: x86_64: avoid recursive address translation for swapper_pg_dir")
Signed-off-by: Omar Sandoval <[email protected]>
Copy link
Contributor

@brenns10 brenns10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks good, thanks for fixing up my lazy coding!

Comment on lines -614 to -615
// this if phys_base is 0, since that likely means it
// was not present in the vmcoreinfo. It has been
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder who was lazy enough to do it that way? :P

@osandov osandov merged commit 36030b9 into main Dec 18, 2024
6 of 33 checks passed
@osandov osandov deleted the phys-base-0 branch December 18, 2024 21:07
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