You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
do you happen to have an existing implementation of the glude code necessary in the guest to issue hypercalls with the vmware backdoor ? Since the implementation exists in QEMU, I guest it was already working before ?
can you detail a bit the existing code in QEMU ? I'm not clear on this line: *((uint32_t *)((uint8_t *)run + run->io.data_offset)) == 0x8080801f). Also handle_kafl_hypercall(run, cpu, env->regs[R_EBX] + 100, env->regs[R_ECX]); why +100 ? 🤔
Thanks !
The text was updated successfully, but these errors were encountered:
The current status regarding vmware backdoor io hypercalls is as follows:
-> We already use this interface in case KVM-Nyx is not installed, and the user does not need Intel PT support (e.g., AFL++ with compile-time instrumentations; thus, the CPU type NYX vCPU (NO-PT)). AFAIK this interface might be disabled if KVM-Nyx is detected by QEMU-Nyx (and consequently, QEMU-Nyx reports the vmcall CPU type) ... but I'm not 100% sure if this is the current state.
-> Btw the reason for using the vmware backdoor interface is that this type of "hypercalls" can be issued from userland and is not limited to CPL0 (like cpuid).
-> So, in case you need a working setup: AFL++ in Nyx mode on a system running a vanilla kernel + vanilla KVM should work just fine (the packer already has an option to either build the agent and all htools with this hypercall type).
-> *((uint32_t *)((uint8_t *)run + run->io.data_offset)) == 0x8080801f) is just a quick hack to avoid collisions with other vmware backdoor based hypercalls (0x8080801f is just a magic number used by Nyx). And the +100 offset is just there to adjust the hypercall number to the KVM exit reason number. Basically, this happens in the kernel in case we use KVM-Nyx (hypercall + 100 -> Nyx exit reason), but it needs to be adjusted in userland in case we use vmware hypercalls.
This ticket explores what's the status of implementing the Nyx hypercall API via the VMware port IO backdoor.
kAFL agent
On the guest side, in
libnyx_agent.c
, there is a dispatcher already implementeddepending on the CPU type returned by CPUID.
QEMU-Nyx
On the QEMU side, in
kvm-all.c:kvm_cpu_exec()
, the handler for the VMware port forwarding the Nyx hypercalls seems to already be hereRelated
vmport
parameter toggles the emulation of the VMware backdoor. (patch)enable_vmware_backdoor=y
on thekvm
module@schumilo
*((uint32_t *)((uint8_t *)run + run->io.data_offset)) == 0x8080801f)
. Alsohandle_kafl_hypercall(run, cpu, env->regs[R_EBX] + 100, env->regs[R_ECX]);
why +100 ? 🤔Thanks !
The text was updated successfully, but these errors were encountered: