Event injection causes VM-exit

Event injection causes VM-exit

Hi, in my effort to create hypervisor, guest VM experiences double and triple fault after first page fault. (guests CR3, GDTR, IDTR, etc... are all set same as in normal exuction, 64bit OS doesn't use task switching, I have no idea what's the reason...)

But that's not my main question. As I tried to dig into this problem, I discovered following behavior:

- i set up VMCS to break on page fault (set exception controls bit 14, error code mask=0, error code match=0)

- i get "page fault" VMX exit (type=hardware exception, vector=14, error code varies)

- i inject/reflect it back to VM (copy interruption info, error code, and instruction length to entry-controls VMCS)

- i get page fault AGAIN, but this time with zero error code, and with IDT-vectoring holding previous page fault

- if i disable catching page faults (set error code match to 0xFFFFFFFF), i get double and triple fault as expected

Problem is that until i disable VM-exiting on page fault, injecting (reflecting) this page fault to VM causes another page fault VM-exit, not double fault as it should. Manual says (3B, 22.5.2) that injecting event on VM entry should never cause it to be catched by VM-exit controls.

In this case, i would expect VM to return with double fault, like when page fault exiting is disabled, not with another page fault. Or did I misunderstood something?

Thanks for explaination in advance

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

More info about this: cause for triple fault was wrong value of TR shadow base. In other cases injecting/reflecting page fault works as expected.

However in this particular case, injecting page fault with VM-exiting on page fault causes another VM-exit as described. I believe this behavior doesn't correspond with what manual says.

Leave a Comment

Please sign in to add a comment. Not a member? Join today