Wait guest to start until VMI is ready

38 views
Skip to first unread message

Jan Hoogerbrugge

unread,
Feb 3, 2020, 9:40:14 AM2/3/20
to vmitools
Hi,

When I connect with libvmi to a guest then the kernel is already running. I would like to trace some events from the
moment the kernel is started. Is there a possibility with Xen with a Linux guest to wait with booting Linux until
a VMI application has connected to the the guest?

Jan.

Tamas K Lengyel

unread,
Feb 3, 2020, 9:43:23 AM2/3/20
to vmit...@googlegroups.com
The guest has no idea that there is an external agent monitoring it so
the only thing you can do is create the domain paused (xl create -p
<config>) and then start the VMI application on it which will unpause
it once it setup the monitoring traps. It is entirely possible to
monitor the VM using LibVMI even before the kernel started. Just don't
use vmi_init_complete, use vmi_init (with events), then
vmi_init_paging once paging is enabled in the guest and finally
vmi_init_os when you detected the kernel has started.
> --
> You received this message because you are subscribed to the Google Groups "vmitools" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vmitools+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vmitools/002725c9-03cf-4b8c-b3f2-69e0f64ac5ef%40googlegroups.com.

Jan Hoogerbrugge

unread,
Feb 8, 2020, 10:07:55 AM2/8/20
to vmitools
Hi Tamas,

Thanks for the answer. It works.

One further question: do you have a method to test whether paging has been enabled and the kernel has started?
At the moment I just wait ten seconds before I call vmi_init_paging and vmi_init_os. It would be good to make
the time window where the guest runs without VMI is as short as possible. I am doing this work on Aarch64.

Jan

Tamas K Lengyel

unread,
Feb 8, 2020, 10:49:00 AM2/8/20
to vmit...@googlegroups.com
Check the registers. For arm64 there is no register events implemented
like we have for x86 but you can periodically query the register state
and make your decision that way. Probably for your use-case it's
enough just to just periodically call vmi_init_paging and when it
succeeds you know that paging is enabled. Then do the same with
vmi_init_os afterwards.
> --
> You received this message because you are subscribed to the Google Groups "vmitools" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vmitools+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vmitools/e5cfed22-a6cb-4ee8-9287-a1b836c3bad1%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages