Open mtarral opened 5 years ago
why are we initializing the Xen interface by ourselves, and using xc_evtchn_fd for external monitoring ? are there any technical/historical reasons for this ?
There are users of DRAKVUF who poll on multiple fd's in the event loop.
why calling xc_domain_pause/unpause directly instead of using Libvmi, which provides these interfaces ?
The pause counts are reference counted by Xen and the LibVMI API just issues a single unpause call, potentially leaving the domain paused. The pause call in LibVMI is also only issued if the domain is not already paused, so if we do actually want to increase the pause count, it won't work.
reagrding xc_altp2m, it's a matter of implementing the vmislat functions in Libvmi.
Correct, that wasn't there when I implemented the altp2m breakpoints in DRAKVUF. Didn't really bother porting it over to LibVMI since no other hypervisor has or likely will have altp2m-like capability.
Instruction emulation is not bullet-proof, as we already discussed previously (#667), but it will at least provide a Drakvuf compatibility with other hypervisors, expanding the community even further (more plugins, more contributors, more users)
While in principle adding another hypervisor sounds nice, doing so with a different breakpoint mechanism would increase complexity tremendously. Instruction emulation is an acceptable route when there is no other way to do it - after all I was going down that road to begin with, that's the only reason why it's even available in Xen - it would be probably a lot easier to detect. So the system would have different stealth properties on different hypervisors. So unless there is a feature of the other hypervisor that we must have, I would not bother porting it. For example, supporting Bareflank/Boxy
I do prioritize over KVM because with that we gain flexibility and abilities that would be hard to implement with any of the other hypervisors (including Xen).
As VMI on KVM is growing and gaining maturity, I wanted to have an overview of the refactoring required to port Drakvuf on KVM.
Gaining multi-hypervisor compatibility
As of today, Drakvuf's design is ambiguous and uses both the LibVMI library as its main abstraction layer for introspection, as well as performing direct calls to Xen.
Listing the linked libraries:
Listing the Xen functions being called:
A couple of questions regarding this:
xc_evtchn_fd
for external monitoring ? are there any technical/historical reasons for this ?xc_domain_pause/unpause
directly instead of using Libvmi, which provides these interfaces ?xc_altp2m
, it's a matter of implementing thevmi_slat_
functions in Libvmi.main question: what is preventing us from rebasing the VMI calls on Libvmi only ?
Refactoring breakpoints to allow for non alternate SLAT hypervisor APIs
Xen is the only hypervisor providing an alternate SLAT API.
We could wait for other hypervisors to level-up their game, but seeing how difficult this is to implement, it would take years.
Another strategy could be to offer another way of handling breakpoints, via instruction emulation.
Instruction emulation is not bullet-proof, as we already discussed previously (#667), but it will at least provide a Drakvuf compatibility with other hypervisors, expanding the community even further (more plugins, more contributors, more users)
This an open discussion, I'd like your comments.
Thanks.