-
Notifications
You must be signed in to change notification settings - Fork 86
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
I have a question about NCR3 switching (AMD) #12
Comments
It could be due to timer interrupt firing immediately after returning to the guest. That would run the other page, which would lead to switching back to the primary table. Then after the interrupt handler completes, the guest would attempt to retry execution of non-executable page, which switches to the secondary table, resulting in an infinite loop. This can happen when #VMEXIT handling takes too long. I too suggest removing the debug print if this is synchronous (eg, DbgPrint). Side note: |
@Zero-Tang @tandasat Thank you guys very much for the reply! I have significantly sped up my vmexit handling, I limited my project to use 1 hook, and I removed all NT function calls in vmexit handler. I basically reduced VMEXIT all the way down to a few variable assignments, and this is the entire VMEXIT handler:
However, now it still appears to be stuck at that exception handler. I will try to gather more information. EDIT: I should also say that I am testing on 1 core |
I finally fixed it, the issue was due to an instruction being split across 2 pages. |
Hello, thank you for the awesome idea of swapping CR3 on vmexit as opposed to switching permissions of each individual page. I am currently trying to implement this in my own AMD hypervisor, for windows. I have a very strange issue when I do that,
I have two tables:
1 primary table, with all pages set to allow RWX, except for 1 hooked page which is RW only
1 secondary table, with all pages set to RW only, except for 1 hooked page, which is RWX and points to my modified copy of the original page
The guest RIP seems to be "stuck" when I swap to secondary table, and strangely this doesn't happen when I allow all pages to be RWX in the secondary table. By being "stuck", I mean that the guest RIP constantly switches back and forth between hooked page and non hooked page, in an infinite loop without even executing anything. I know this doesn't have anything to do with instructions being split across pages, I flushed TLB properly, and I also cleaned VMCB cache bits.
My question: Have you had any similar problems when you implemented NCR3 switching?
Here is a snippet of my code, in vmexit handler:
The text was updated successfully, but these errors were encountered: