Skip to contentSkip to conversation

AMD VMMCALL and VM86 mode

DISCUSSION Andrew Cooper 2 participants 4 messages Dec 9, 2016 – Dec 10, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

While working on XSA-192, I found a curious thing. On AMD hardware, the VMMCALL instruction appears to behave like a nop if executed in VM86 mode. All other processor modes work fine.

The documentation suggests it should be valid in any situation, but I never get a #VMEXIT from it. Thus, I would have thought it would fall into the un-intercepted category and raise a #UD fault, but I don't get that either.

Is this behaviour expected? The documentation would certainly seem to indicate not.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 8 lines · Andrew Cooper

Hello,

While working on XSA-192, I found a curious thing. On AMD hardware, the VMMCALL instruction appears to behave like a nop if executed in VM86 mode. All other processor modes work fine.

The documentation suggests it should be valid in any situation, but I never get a #VMEXIT from it.

And I assume GENERAL2_INTERCEPT_VMMCALL is set (which is what we have in Xen by default)?

What happens if you don't set it?

-boris

Quoted 6 lines

Thus, I would have thought it would fall
into the un-intercepted category and raise a #UD fault, but I don't get that either.

Is this behaviour expected? The documentation would certainly seem to indicate not.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 11 lines · Boris Ostrovsky
Quoted 8 lines · Andrew Cooper

Hello,

While working on XSA-192, I found a curious thing. On AMD hardware, the VMMCALL instruction appears to behave like a nop if executed in VM86 mode. All other processor modes work fine.

The documentation suggests it should be valid in any situation, but I never get a #VMEXIT from it.

And I assume GENERAL2_INTERCEPT_VMMCALL is set (which is what we have in Xen by default)?

Yes, because I have already used hypercalls to get text to the console before entering vm86 mode.

Quoted 1 line

What happens if you don't set it?

Let me do some hacking and see.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Boris Ostrovsky
Quoted 8 lines · Andrew Cooper

Hello,

While working on XSA-192, I found a curious thing. On AMD hardware, the VMMCALL instruction appears to behave like a nop if executed in VM86 mode. All other processor modes work fine.

The documentation suggests it should be valid in any situation, but I never get a #VMEXIT from it.

Quoted 7 lines
Quoted 2 lines

And I assume GENERAL2_INTERCEPT_VMMCALL is set (which is what we have in Xen by default)?

Yes, because I have already used hypercalls to get text to the console before entering vm86 mode.

Quoted 1 line

What happens if you don't set it?

Let me do some hacking and see.

Outside of vm86 mode, VMMCALL raises #UD, which is expected as it wasn't intercepted.

From within vm86 mode, I now get #GP rather than #UD.

There is certainly an argument to be made that VMMCALL inside vm86 mode should trap to the vm86 monitor and #GP would be the expected way of that happening, but this also doesn't match the documentation.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel