[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 6/7] x86/hvm: Add SMAP support to HVM guest




> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Thursday, April 24, 2014 4:28 PM
> To: Wu, Feng
> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx; Dong, Eddie;
> Nakajima, Jun; Tian, Kevin; xen-devel@xxxxxxxxxxxxx
> Subject: RE: [PATCH v2 6/7] x86/hvm: Add SMAP support to HVM guest
> 
> >>> On 24.04.14 at 10:19, <feng.wu@xxxxxxxxx> wrote:
> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> >> >>> On 23.04.14 at 16:37, <feng.wu@xxxxxxxxx> wrote:
> >> > +        smap = hvm_smap_enabled(v) &&
> >> > +               !(!ring_3(regs) && (regs->eflags & X86_EFLAGS_AC));
> >>
> >> ring_3() isn't supposed to be used for HVM guests. Please use proper
> >> HVM methods here.
> >
> > To get the guest CS, I should use the following code path, right?
> > hvm_get_segment_register() --> vmx_get_segment_register()
> >
> > I don't find any HVM methods, so can I just use ((regs->cs & 3) < 3) here?
> 
> I'm confused - you found the method, but you say you didn't?
> hvm_get_segment_register() is the correct one (just that you
> need to do this on SS rather than CS, and on the DPL field rather
> than the selector's RPL - there are a number of existing cases you
> could use as reference; just grep for comparisons of
> attr.fields.dpl with 3).
> 

Sorry, I did express it clearly. I found the HVM method for getting the guest 
segment.
What I meant above is that I didn't find a function or marco for HVM like 
ring_3() for PV,

Thanks for the information, I got some examples, so I guess l can use something 
like this here:

(attr.fields.dpl < 3)

> Jan

Thanks,
Feng

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.