From: "Jan Beulich" Subject: Re: Bisected Xen-unstable: "Segment register inaccessible for d1v0" when starting HVM guest on intel Date: Thu, 03 Jul 2014 09:59:20 +0100 Message-ID: <53B537880200007800020014@mail.emea.novell.com> References: <1057886355.20140628222158@eikelenboom.it> <53B1A244020000780001EA4D@mail.emea.novell.com> <1081819750.20140630183750@eikelenboom.it> <53B19EEB.4060603@citrix.com> <53B27902020000780001ED8B@mail.emea.novell.com> <53B29E03020000780001EF03@mail.emea.novell.com> <53B3CA8A020000780001F4B4@mail.emea.novell.com> <53B3D5D2020000780001F4F8@mail.emea.novell.com> <53B3ECEE020000780001F61F@mail.emea.novell.com> <53B423B3020000780001F8C5@mail.emea.novell.com> <53B51927020000780001FF0A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X2crR-0002cm-Qc for xen-devel@lists.xenproject.org; Thu, 03 Jul 2014 08:59:22 +0000 In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: Andrew Cooper , "xen-devel@lists.xenproject.org" , Sander Eikelenboom List-Id: xen-devel@lists.xenproject.org >>> On 03.07.14 at 10:17, wrote: > >> -----Original Message----- >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Thursday, July 03, 2014 2:50 PM >> To: Wu, Feng >> Cc: Andrew Cooper; Sander Eikelenboom; xen-devel@lists.xenproject.org >> Subject: RE: [Xen-devel] Bisected Xen-unstable: "Segment register inaccessible >> for d1v0" when starting HVM guest on intel >> >> >>> On 03.07.14 at 08:15, wrote: >> > After thinking a little more about what you said in this thread, here is > the >> > basic ideas >> > I get about this PV extension: >> > 1. With this PV extension, when Xen tries to access guest memory for >> > non-emulation >> > purpose, we always treat this access as a supervisor mode. >> >> The fact that these accesses are to be consider supervisor mode ones >> goes without saying. The question is how to treat them when SMAP is >> enabled: As said before, while the runstate area update clearly should >> always be subject to validation, for the secondary time area update >> it needs to be investigated (possibly the guest needs to be given >> control over what it wants the behavior to be). > > Need more time to think about how to handle case 2. If we need guest's hint, > can we get it from 'VCPUOP_register_vcpu_time_memory_area' hypercall ? Obviously not, as there's no room in the hypercall argument to pass that information. Also it's not clear to me in this context what "case 2" you refer to above. >> > 2. We need always do SMAP checking for those Xen accesses when SMAP is >> > enabled by >> > the HVM guests. However, if the guest is actually running in Ring 0 and >> > X86_EFLAGS_AC >> > bit is set by it, if we got an SMAP violation while doing the SMAP check, is >> > this overkilled? >> >> The point is that these accesses are asynchronous (i.e. the >> guest can't know when they will happen), and hence making them >> dependent on current guest state would be bogus (I listed this as >> an option earlier irrespective of that). > > So > For case 1, the guest virtual address should be a in guest supervisor-only > accessible page, > We need to do the SMAP check, if the guest virtual address happens to be a > user-accessible > one, an SMAP violation happens > > For case 2, the guest virtual address may be a user-accessible one, but this > is intended > by the guest, so we need some hints from the guest to determine how to > handle it. "how" is probably the wrong term here, since "how" only (and directly) depends on whether the VA is a user visible one. Jan