|
libintrovirt v0.57.4
IntroVirt introspection library
|


Public Member Functions | |
| void | process_event (Event &event) override |
| void | handle_syscall (Event &event) |
| void | handle_sysret (Event &event) |
| void | handle_hypercall (Event &event) |
| int | service_string_reverse (Event &event) |
| int | service_write_protect (Event &event) |
| void | memory_access_violation (Event &event) |
| int | service_protect_process (Event &event) |
| void | cleanup () |
| void | process_event (Event &event) override |
| Process an incoming event. | |
Public Member Functions inherited from introvirt::EventCallback | |
| virtual | ~EventCallback ()=default |
Public Attributes | |
| map< uint64_t, list< unique_ptr< Watchpoint > > > | read_only_protections_ |
| set< uint64_t > | protected_pids_ |
| mutex | mtx_ |
This is our callback class for handling IntroVirt events. It implements the core logic for this example.
It processes all received events, handling hypercalls and system calls as needed. In the case of this example, we only need to track NtTerminateProcess system calls so we can clean up our write-protections when a process terminates itself.
|
inline |
|
inline |
This method is called when we receive a EVENT_HYPERCALL event.
Here we print out some basic information about the hypercall, and perform more complex actions if a valid service code is provided in the RCX register.
|
inline |
This method is called when we receive a EVENT_FAST_SYSCALL event.
Handle NtTerminateProcess to clean up protections when a process exits. Also, prevent termination of protected processes.
|
inline |
This method is called when we receive a EVENT_FAST_SYSCALL_RET event.
|
inline |
This is our memory access violation handler.
|
inlineoverridevirtual |
The main event callback method. Every event received from the hypervisor is passed to this method for processing. We only care about hypercalls and system calls in this example.
The EVENT_FAST_SYSCALL_RET event is used to handle the return from system calls.
Implements introvirt::EventCallback.
|
inlineoverridevirtual |
|
inline |
This is the handler for the PROTECT_PROCESS service code.
It demonstrates how to protect a process from being terminated, injected into, or debugged by other processes in the guest.
The logic that performs the protection is not in this method. Instead, we do the protection in our system call handler. All this needs to do is add the PID to our protected list.
|
inline |
This is the handler for the CSTRING_REVERSE service code.
It demonstrates how to read a C-style string from guest memory, reverse it in place, and handle any potential memory access issues.
It is very common to need to read and write guest memory when writing IntroVirt tools. The guest_ptr<> class and related helper functions make this easy and safe.
|
inline |
This is the handler for the WRITE_PROTECT service code.
It demonstrates how to create a watchpoint on a memory region to make it read-only from the guest's perspective. Any write attempts to this region will trigger a memory access violation that we can handle in the hypervisor.
| mutex EventHandler::mtx_ |
| set<uint64_t> EventHandler::protected_pids_ |
| map<uint64_t, list<unique_ptr<Watchpoint> > > EventHandler::read_only_protections_ |