-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Ease debugging Xen issues #6834
Comments
It was discussed briefly off issue that a debug ISO would miss the point, where having a different xen-debug source tree, clearly differentiable from the Xen standard target, would make it easier to maintain and deploy from testing repository when needed. That Xen + linux emergency kernel to be kexec'ed + kexec dependencies for dom0 should make its way into a grub clearly separated entree for users to select and as wished end result, be able to extract needed information from the memory dump (saved under /boot? which was why I talked about a debug ISO at the first place, so that /boot is big enough to dump memory content? Saved under swap? As Marek stated, having the emergency kernel dump into root would require LUKS key to be passed, which in most user cases is not possible.) Thoughts on better approaches? |
I'm inclined to help into this and maybe a specific ISO_FLAVOR could be weekly built. |
Dumping into |
I'd rather embed LUKS key into the initramfs that is loaded to be kexec'ed. Such initramfs would be sensitive then, so storing it in
Since Argon used by LUKS2 needs more RAM than its useful to assign for the crash kernel (*), I consider injecting the actual LUKS master key. This may need some initramfs adjustments. Alternative option is to dump into some USB stick. But that's way less reliable (especially if kexec'ed Linux won't undo IOMMU setup done by Xen). (*) This memory needs to be reserved at the boot time, and cannot be used for anything else - if you need 1.5GB for the crash kernel, you'd have that much less for the actual system. |
This definitely seems like the better option. Having the key be in a file on disk risks it leaking, which would be bad. I would much prefer for it to remain entirely in-memory. |
Excellent idea @brendanhoar! After few tweaks and hitting unrelated bug, I got this working :) Debugging suspend issues should be much easier (for me, at least) now. |
I wanted to extract the master key from the running kernel, but this is actually impossible on R4.1, because cryptsetup loads it into kernel keyring as a "logon" key - which can be read only by the kernel. I mean, technically there surely is some hack to extract it, but not a proper API. This means, we either need to store a keyfile somewhere on the disk, or ask the user for disk passphrase the second time during boot (or more precisely: when loading crash kernel). |
Patch cryptsetup? |
No, I don't want to weaken security feature for everyone, just to make debugging easier for few. |
Serious question: how is this security feature useful in Qubes OS? Once someone has code exec in dom0 it is game over anyway. |
Since QubesOS/qubes-vmm-xen#138 is merged, here is how to use it to get Xen's console:
|
So if I understand Too bad that my T530 apparently has no dbc/debug port... -_- |
It can be, but doing so allows |
On 10/31/22 09:07, Demi Marie Obenour wrote:
> So if I understand `share=yes` correctly, the device can even be assigned to `sys-usb` at the same time? That's awesome!
It can be, but doing so allows `sys-usb` to take control of the system.
Ok, so a dedicated dom0 USB device/port is more optimal after all...
|
Btw is serial port debugging still supported and will it remain supported? I'm asking because I don't see |
As Demi noted, this has some risks associated. If you want, you can use
Yes. But it's increasingly hard to have an actual serial port in a laptop.
I think you're confusing Linux config with Xen config. |
I got dom0 kernel logs via UART running by adding Do these include the Xen logs? The Xen instructions didn't work for me (I tried |
Yeah the pci card/expresscard needs to be a real UART serial port, not a usb port + usb serial device. Even then I think @marmarek ran into some issues getting Xen to use a real one, IIRC. B |
Help! I'm trying to debug a Xen crash using a PCIe-to-serial adapter, but I'm unable to activate it in Xen. I tried passing Is there anything else I can do to enable this port? Or does it mean that this serial port is incompatible due to missing hardware quirks, and cannot be used? This PCIe adapter shows up in Dom0 as:
|
Update: I forgot to check something really basic, which is typing "AX99100 Xen" into a search engine. After I tried, I found this:
According to this comment, it can't be used on Xen 4.17, but it works the development version... Could the support be backported to Xen 4.17? Finally, which PCIe chipset should I hunt for in order to work with Xen 4.17? |
If you use Xen 4.17 package from Qubes, it does work with this specific card. The cmdline option would be |
@biergaizi I used the same card and it worked for me in Qubes OS 4.1 (Xen 4.14).
And it worked with |
I'm still unable to get even a single byte of Xen log from the serial port. For completeness, the boot configuration I'm using right now is:
My card only has 1 port.
It does work under Dom0 if I do this:
Remote host can receive "Hello, world":
|
@biergaizi Try to boot from some Live Linux (Fedora/Debian/etc) and check how this device is seen there (check its
But when I boot in another OS (I've checked it in Qubes OS installer) then the real IRQ was shown that worked for me. |
Is it perhaps behind a bridge that needs to be enabled too? Check If not that, I'm afraid I'm out of ideas. It does work for me here: https://openqa.qubes-os.org/tests/116354/logfile?filename=serial0.txt ... If I'd have to debug it further, I'd probably add some debug prints around console init code, especially checking PCI_COMMAND etc registers at that time. You can extract those messages with |
Problem solved.
should be:
In other words, the original argument suggested by @marmarek worked as advertised, thanks for the help. It's easy to miss this typo after you keep rebooting the machine mindlessly for an hour... Lesson learned: Always double check both |
On laptops lacking physical serial console, collecting logs of a crashed Xen (or dom0 kernel) is hard. One method is to use kexec to extract them from the RAM. Currently this requires several non-trivial changes to the system. This issue is to ease preparing system for such debugging.
Details from the original issue:
@marmarek @fepitre
From this comment:
This exact QubesOS 4.1 ISO deployment (debug iso with all above dependencies preconfigured) would help to debug so many corner cases for QubesOS project, including this one? Instruct a willing tester to install QubesOS on spare drive and report results without having to go through the burden of customizing such testing testbed? Should that be discussed in a separate issue (with more details on doing this manual and then automate the process, maybe?)
@marmarek / @fepitre : Random thought, but if there is enough space affected to /boot in the default partitition scheme of that debug iso, dumping said logs from kexec'ed linux kernel to dump memory under /boot would work around a lot of the complexity added dumping needed logs and go faster into having what logs we need, easily, from an additioanl boot of said debug ISO in Read Only rescue mode from boot options.
Originally posted by @tlaurion in #6066 (comment)
The text was updated successfully, but these errors were encountered: