vmx: correct EIP value of task-state segment
PATCH 1/1 vmx: correct EIP value of task-state segment
Major OSes(Linux, windows, ...) don't seem to use task switching. So this bug is missed.
xen/arch/x86/hvm/vmx/vmx.c +2 -0
@@ -2490,6 +2490,8 @@ asmlinkage void vmx_vmexit_handler(strucif ( (idtv_info &INTR_INFO_VALID_MASK ) && (idtv_info &INTR_INFO_DELIVER_CODE_MASK ) ) errcode =__vmread (IDT_VECTORING_ERROR_CODE ); + inst_len =__get_instruction_length ();/* Safe: See SDM 3B 23.2.4 */ + regs->eip += inst_len;hvm_task_switch ((uint16_t )exit_qualification, reasons[(exit_qualification >>30 ) &3 ], errcode);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Kouya Shimura
Major
OSes(Linux, windows, ...)don't seem to use task switching. So this bug is missed.Signed-off-by Kouya Shimura <[email protected]>
What about SVM, and what if the reason for the task switch is a hardware interrupt or exception (the only case we care about for Windows at least)?
The reference manuals are sketchy enough you may need to test out some task switches on SVM and VMX hardware to make sure you make patches that really do the right thing.
-- Keir
Quoted 2 lines · Keir Fraser
What about SVM, and what if the reason for the task switch is a hardware interrupt or exception (the only case we care about for Windows at least)?
Unfortunately I have no SVM machine.
The task switch is a software interrupt "int $2" in a proprietary OS.
Quoted 3 lines
The reference manuals are sketchy enough you may need to test out some task switches on SVM and VMX hardware to make sure you make patches that really do the right thing.
Sorry, I don't have much time to test this.
But the OS works fine with this patch. (of course, the OS is for native) I confirmed Windows(XP,2008Server) never use a task switch. So I think it's worth to get in the tree.
Thanks,
Kouya
Quoted 7 lines · Kouya Shimura
Quoted 3 lines
The reference manuals are sketchy enough you may need to test out some task switches on SVM and VMX hardware to make sure you make patches that really do the right thing.
Sorry, I don't have much time to test this.
But the OS works fine with this patch. (of course, the OS is for native) I confirmedWindows(XP,2008Server)never use a task switch.
They do on blue screen I believe. OTOH I suppose they don't come back from it. I'll have to queue this up for testing myself.
Is the "int 2" in that popular proprietary OS "BS2000" perchance? ;-)
-- Keir
Quoted 1 line
So I think it's worth to get in the tree.
Quoted 5 lines · Keir Fraser
Quoted 3 lines · Kouya Shimura
Quoted 3 lines
The reference manuals are sketchy enough you may need to test out some task switches on SVM and VMX hardware to make sure you make patches that really do the right thing.
Quoted 8 lines
Quoted 3 lines
Sorry, I don't have much time to test this.
But the OS works fine with this patch. (of course, the OS is for native) I confirmedWindows(XP,2008Server)never use a task switch.They do on blue screen I believe. OTOH I suppose they don't come back from it. I'll have to queue this up for testing myself.
Is the "int 2" in that popular proprietary OS "BS2000" perchance? ;-)
:-)
No, it isn't.
And we are not doing task switches.
Juergen
Signature · 5 lines
Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 636 47950 Fujitsu Technolgy Solutions e-mail: [email protected] Otto-Hahn-Ring 6 Internet: ts.fujitsu.com D-81739 Muenchen Company details: ts.fujitsu.com/imprint.html
Quoted 9 lines · Juergen Gross
Quoted 4 lines
They do on blue screen I believe. OTOH I suppose they don't come back from it. I'll have to queue this up for testing myself.
Is the "int 2" in that popular proprietary OS "BS2000" perchance? ;-)
:-)
No, it isn't.
And we are not doing task switches.
Okay. Well, I don't disagree we should get this fixed. The patch is in my todo queue now.
-- Keir
Hi Kouya,
I applied an extended version of your patch as c/s 20097. It should do the right thing for task switches triggered by ExtInt, NMI, or hardware exception (i.e, not update EIP in those cases). It would be good if you could take a look and also test.
It's worth noting that I did not fix the AMD SVM case as that is rather trickier. This is because SVM does not provide the instruction length, so we would have to decode it ourselves. And the instruction can be a fairly arbitrary JMPF/CALLF variant, so we would have to smarten up the SVM insn-len decoder considerably (to decode effective addresses, for example), or go into x86_emulate() and have that properly emulate task switches. Neither is an attractive work item. :-) If I had to pick one I'd probably go for a smarter insn-len decoder, even though that's aesthetically perhaps more 'hacky'. But someone who cares can go do the work.
-- Keir
Quoted 5 lines · Kouya Shimura
Major
OSes(Linux, windows, ...)don't seem to use task switching. So this bug is missed.Signed-off-by Kouya Shimura <[email protected]>
Hi Keir,
Thanks for remembering.
It looks good. And our proprietary OS works fine.
Thanks a lot.
Nonsupporting the AMD SVM case is no problem for us. The OS is embedded to an Intel platform and we have no plan to use an AMD platform.
Thanks,
Kouya
Quoted 27 lines · Keir Fraser
Hi Kouya,
I applied an extended version of your patch as c/s 20097. It should do the right thing for task switches triggered by ExtInt, NMI, or hardware exception (i.e, not update EIP in those cases). It would be good if you could take a look and also test.
It's worth noting that I did not fix the AMD SVM case as that is rather trickier. This is because SVM does not provide the instruction length, so we would have to decode it ourselves. And the instruction can be a fairly arbitrary JMPF/CALLF variant, so we would have to smarten up the SVM insn-len decoder considerably (to decode effective addresses, for example), or go into
x86_emulate()and have that properly emulate task switches. Neither is an attractive work item. :-) If I had to pick one I'd probably go for a smarter insn-len decoder, even though that's aesthetically perhaps more 'hacky'. But someone who cares can go do the work.-- Keir
Quoted 5 lines · Kouya Shimura
Major
OSes(Linux, windows, ...)don't seem to use task switching. So this bug is missed.Signed-off-by Kouya Shimura <[email protected]>