From: Keir Fraser Subject: Re: Doamin crash when trying to install disk encryption (PointSec) on Windows HVM Date: Thu, 23 Apr 2009 18:16:30 +0100 Message-ID: References: <8686c3cd0904230910r1b9aca6ay512f6c6fc03a6a84@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <8686c3cd0904230910r1b9aca6ay512f6c6fc03a6a84@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tom Rotenberg , Tim Deegan Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org A task switch reloads on segment registers, so it is impossible to enter vm86 mode with 'bad' segment state even via a task switch. If the guest really is trying to enter vm86 mode via a task switch (which would be somewhat bizarre, although a valid thing to do) then hvm_load_segment_selector() needs updating to deal with VM86 mode. I'll mak= e a patch. -- Keir On 23/04/2009 17:10, "Tom Rotenberg" wrote: > So, do u have any suggestion, on how can i fix this issue? >=20 > 2009/4/23 Tim Deegan >> At 16:57 +0100 on 23 Apr (1240505849), Tom Rotenberg wrote: >>> Keir, >>>=20 >>> After further testing, it seems like the flow of events were like this: >>> there was a VMEXIT with the reason of task switch, which changed to vm8= 6mode >>> (!), and upon trying to resume from this vmexit, the cpu raised an >>> exception. >>>=20 >>> And the question is why and how did the task switch caused the vm86 >>> mode to be turned on? is it even legal? >>=20 >> Yes, task-switching into vm86 mode is legal; ISTR it and IRET are the >> only ways mentioned in the SDMs of getting into vm86. >>=20 >> Looks like Xen doesn't support it, though. =A0It would need special >> handling of the segment state to get round the extra restrictions that >> Intel imposed on VMENTER (which are stricter than the limits on using >> vm86 mode unvirtualized). >>=20 >> Cheers, >>=20 >> Tim. >>=20 >>> Tom >>>=20 >>> 2009/4/23 Keir Fraser >>> > >>> All task switches are emulated, so you can add tracing to hvm_task_swit= ch() >>> to check if a switch has occurred. An alternative is that the guest did >>> another LTR while not being emulated? >>>=20 >>> If you want to remember the last VMEXIT, you?ll have to add code to sto= re >>> state away somewhere to pick up on the next VMENTRY. >>>=20 >>> =A0-- Keir >>>=20 >>>=20 >>> On 23/04/2009 15:08, "Tom Rotenberg" >>> >>> >> wrote: >>>=20 >>> About the TR, i have re-checked it, and it seems like the TR value is s= till >>> 0x58, althoug the LTR operation put 0x50 into it. Since, i looked at th= e LTR >>> code you sent me, and it seems ok, i tend to suspect, that there was so= me >>> kind of (hardware) task switch, which changed the TR value without me >>> knowing, is it possible? because otherwise, i can't really explain why = the >>> TR value is different than what was loaded from the LTR operation... >>>=20 >>> BTW - how can i track what was the previous VMEXIT before this last VME= NTRY >>> which caused the exception? i think, that probably the last VMEXIT caus= ed >>> the "change" to vm86 mode, and this is waht causes the problem... >>>=20 >>> Tom >>>=20 >>> 2009/4/23 Keir Fraser >>> >> >> >>> On 23/04/2009 12:44, "Tom Rotenberg" >>> >>> >> wrote: >>>=20 >>>> However, from the VMCS dump, i saw data, which doesn't seem compatible= with >>>> this, as the LDTR sellector is indeed 0, but has attributes and limit >>>> different from zero (although it should have been totaly disabled, by = the >>>> LLDT, no?). >>>=20 >>> The 'unused' flag in the attributes word is set (bit 16) so LDTR is oka= y. >>>=20 >>>> And more important, the TR selector is 0x58, although from the LTR, it= was >>>> supposed to be 0x50, no? >>>=20 >>> If 0x50 was loaded then the selector should certainly be 0x50. >>>=20 >>> =A0-- Keir >>>=20 >>>> (of-course it's possible that there were other instructions who change= d it >>>> back, however, i am wondering if there is a problem here). >>>=20 >>>=20 >>>=20 >>=20 >> -- >> Tim Deegan >> Principal Software Engineer, Citrix Systems (R&D) Ltd. >> [Company #02300071, SL9 0DZ, UK.] >=20