Skip to content

Fix full memory dumps on amd64 #1706

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

VexedUXR
Copy link
Contributor

Currently, libkvm can't read full memory dumps correctly on amd64 since it assumes the kernel was loaded at 2M physical. Fix this by adding the kernel's physical address in an auxiliary ELF section, similar to what arm does.

This seems to have been broken since 13.1 (see 8ca493f and 1b33aa1), so document that.

From my testing, this also stops kgdb and lldb from crashing when trying to open full memory dumps.

VexedUXR added 3 commits May 23, 2025 14:05
Provide the kernel's physical address in an ELF section when doing a
full memory dump on amd64. This allows libkvm to figure out where the
kernel was loaded in physical memory.

Signed-off-by: Ahmad Khalifa <[email protected]>
amd64 kernels don't have to be loaded at 2M physical anymore, they can
be anywhere in the lower 4G of the physical address space. The kernel
now provides its physical address in an ELF section in the dump, so
account for it.

Signed-off-by: Ahmad Khalifa <[email protected]>
Starting 13.1 the amd64 kernel was made relocatable, but the kernel
didn't provide enough information for libkvm to figure out where it was
loaded.

Signed-off-by: Ahmad Khalifa <[email protected]>
nl[1].n_name = 0;

/* XXX
* Relocatable kernels can still be loaded at 2M.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kernels loaded with copy_staging enabled in the loader (which isn't the default) will still be at 2M. There doesn't seem to be a way to detect if they were actually loaded there though.

The only way to read such dumps seems to be to read the dump anyways, at the risk of reading garbage.

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