Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVM: handle instruction emulation response for any kind of events #39

Open
Wenzel opened this issue Nov 30, 2020 · 3 comments
Open

KVM: handle instruction emulation response for any kind of events #39

Wenzel opened this issue Nov 30, 2020 · 3 comments

Comments

@Wenzel
Copy link
Member

Wenzel commented Nov 30, 2020

Instruction emulation response is currently only available as a kvmi_event_pf_reply response:
https://github.com/KVM-VMI/kvm/blob/kvmi-v7/Documentation/virt/kvm/kvmi.rst#10-kvmi_event_pf

Libvmi has the VMI_EVENT_RESPONSE_SET_EMUL_INSN event response that could be implemented for the KVM driver.
An example already demonstrate how to use it:
https://github.com/KVM-VMI/libvmi/blob/master/examples/breakpoint-emulate-example.c#L87

It would be handy for the instruction emulation response in KVM to not be limited only for pagefaults.

The use case behind this is to return the original opcode when breakpoint was hit, previously replaced by an int 3 opcode.
This allows to have relatively cheap race condition free breakpoints with Libvmi / KVM.

The fallback solution right now is to use recoiling:
https://github.com/KVM-VMI/libvmi/blob/master/examples/breakpoint-recoil-example.c

cc @mdontu, @adlazar, @tklengyel

@wangbaba523
Copy link

Hello, I try to use recoiling like 'breakpoint-recoil-example.c',but the bp event enters an infinite loop.
VEE2M%HF6)7EG%%(49MO%UH
QXOLQ1GNZUZIJMNY9M ~N

@Wenzel
Copy link
Member Author

Wenzel commented Dec 15, 2020

@wangbaba523 , create a dedicated issue as this has nothing to do with this one.

@wangbaba523
Copy link

Oh,I try to use below relatively cheap race condition free breakpoints with Libvmi / KVM ,But it can't run successfully!

The fallback solution right now is to use recoiling:
https://github.com/KVM-VMI/libvmi/blob/master/examples/breakpoint-recoil-example.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants