Remove HYPERCALL_DEBUGGING and hypercall_host_module
- Dominant language
- C
- Stars
- 44
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Since `drk` is a kernel module, when it crashes it will usually cause a kernel panic. Therefore, ideally we want to run `drk` inside a virtual machine during development. `HYPERCALL_DEBUGGING` was an experimental feature designed to extract debug logs and other data from the guest environment to the host machine using KVM hypercalls. Currently it's implemented for 3 functions in `core/kernel_linux/os.c`: `os_close()`, `os_write()`, and `os_flush()`.
However, there are some issues with this approach:
1. Incomplete guest implementation. For example, it is not implemented for `os_open()` and `os_read()`.
2. We need to maintain an additional host kernel module, potentially running on a different kernel version. This adds significant complexity.
3. Incompatibility with upstream KVM. Mainline KVM does not support registering custom callbacks for arbitrary hypercalls. As we can see in `DynamoRIO/drk/core/kernel_linux/host_modules/Module.symvers.in`, the original author was probably using a patched `kvm-kmod` module which exported non-standard `kvm_register_hypercall_callback()`/`kvm_remove_hypercall_callback()`. This custom `kvm-kmod` module is also not tracked in this repo.
Therefore, I think we should remove the `HYPERCALL_DEBUGGING` feature and the `hypercall_host_module`, and replace their functionalities with standardized KVM features. The following approaches could be considered:
1. Emulated serial port.
2. `virtio-serial`/`virtio-console`
3. `vsock` (Virtio sockets) for guest-to-host RPC
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.