-
Notifications
You must be signed in to change notification settings - Fork 159
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
Allow overriding / providing vmcoreinfo data #350
Comments
Hi, I encountered an issue while using
I would like to know if this error is related to the issue you mentioned? |
Yes, this error is at least related to this issue! It comes from here in the code. Essentially, the vmcoreinfo note contains metadata that Drgn needs in order to understand the vmcore, but your vmcore does not have a vmcoreinfo note -- or at least, it doesn't have it easily accessible. A resolution to this issue might allow you to open this vmcore in Drgn. A few questions, if you don't mind helping us out:
Instructions for compiling & using the program (I assume you have libkdumpfile headers available since it looks like you built drgn from source)
Let me know the output and provide the |
Thank you so much for your assistance! I truly appreciate your help.
Please let me know if there is anything else I can provide or if there are any further steps you recommend. |
That's an error I've never seen before. The error is coming from libkdumpfile. It indicates that there's a page with encoded size of 0. That's very odd, and libkdumpfile believes that it indicates a corrupted file. Corrupted could mean a few different things: (1) damaged data, which is unlikely but possible, or (2) the hypervisor generated the diskdump format incorrectly, or (3) the hypervisor generated correct data but libkdumpfile hit a bug. I'd put my money on (2), but (3) does happen rarely, and (1) is quite unlikely. In any case, I pushed some changes to that tool in the Do you have any tool which is actually capable of reading this file? It would help me to understand whether this is just an issue you observe with Drgn, or whether this entire vmcore is problematic. |
Do you think it would be possible to attach to drgn to a raw memory dump of a virtual machine (e.g., QEMU's I constructed a custom drgn program with |
Hi @iostapyshyn Providing vmcoreinfo to drgn should be enough to do this, at least in theory. In practice, though, there's not yet a way to make a custom Program have the When loading the core dump, if a kernel dump is detected, drgn adds a special memory reader which does page table translation. If you never load a core dump, because you're adding a custom memory reader, then drgn will never add those memory readers, nor will it set The branches I've worked on carry on with that assumption. They do allow you to give drgn some amount of information it would need, but they wouldn't (yet) get the page table translation working with a custom memory reader. I have a branch called vmcoreinfo which I went ahead and rebased/updated. Like I said it won't work for your particular use case, but I think I need to start getting this merged before we can really start thinking about solutions to the other problems I've outlined. It's just been on the back burner for me. |
Thanks for the answer, it all makes perfect sense!
I have implemented platform = drgn.Platform(drgn.Architecture.X86_64,
drgn.PlatformFlags.IS_LITTLE_ENDIAN | drgn.PlatformFlags.IS_64_BIT)
prog = drgn.Program(platform)
prog.set_image("/dev/shm/qemu-ram") It works wonderfully, but isn't as pretty internally as I hoped due to the following QEMU quirk: When using a file as QEMU a memory backend (via I also had to fix the address translation issue that you mention in #396, I will comment there in a moment on that matter. |
That is really cool. It's quite exciting that this is possible with so few code changes on the drgn side. I agree that it may not be general enough, the address mismatch issue sounds pretty architecture-specific. But I think this reveals two interesting items that could be useful for custom programs.
With these two things, my vmcoreinfo changes, and a fix for address translation with |
Closed in #396! |
I had a bit of a hack that let me specify my own vmcoreinfo note, in case the one provided is incorrect or missing.
-device vmcoreinfo
virtual device.In either case, the vmcoreinfo note itself is generally still present somewhere inside the guest memory, and it's not actually that tough to find. I have a tool that can search the pages of an ELF/kdump vmcore for the vmcoreinfo note, rather quickly based on the idea that it will only appear at a PAGE_SIZE boundary, and it will start with
OSRELEASE=
.Supposing you've used such a tool, Drgn should have an advanced feature somewhere to allow you to specify your own vmcoreinfo note. Crash doesn't allow this exact feature -- but it lets you specify architecture/configuration details such as KASLR offsets which would normally be found in the note.
The hack I had allowed you to specify the vmcoreinfo note contents in an environment variable, which was a bad API. Spitballing a few APIs here (mostly thinking of Python-facing API):
set_core_dump()
(and friends) to accept an optional buffer which contains the vmcoreinfo. This would raise the question of whetherset_kernel()
would allow it, since that's functionally the same asset_core_dump("/proc/kcore")
.Program
constructor.Of those, I prefer the optional parameter to the
Program
constructor. It's nice because it mirrors theplatform
parameter, and in cases where vmcoreinfo is broken, typically the other fields which drgn relies on to determine the platform are also broken, so Drgn would fail to read the vmcore without specifying platform as well.@osandov if you have a preferred API, let me know. Feel free to assign me on this (I can't update assignees, labels, etc). I'll probably submit something within the next month or two when I find time for it.
The text was updated successfully, but these errors were encountered: