From: "Jan Beulich" Subject: Re: [PATCH 2/2] x86/hvm: honor guest's option when updating secondary system time for guest Date: Fri, 25 Jul 2014 08:25:59 +0100 Message-ID: <53D222A70200007800025D05@mail.emea.novell.com> References: <1404775098-6083-1-git-send-email-feng.wu@intel.com> <1404775098-6083-3-git-send-email-feng.wu@intel.com> <53CFC4690200007800025159@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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: "linux@eikelenboom.it" , "tim@xen.org" , "keir@xen.org" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 25.07.14 at 06:30, wrote: > >> -----Original Message----- >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Wednesday, July 23, 2014 8:19 PM >> To: Wu, Feng >> Cc: linux@eikelenboom.it; xen-devel@lists.xen.org; konrad.wilk@oracle.com; >> keir@xen.org; tim@xen.org >> Subject: Re: [PATCH 2/2] x86/hvm: honor guest's option when updating >> secondary system time for guest >> >> >>> On 08.07.14 at 01:18, wrote: >> > --- a/xen/include/public/vcpu.h >> > +++ b/xen/include/public/vcpu.h >> > @@ -227,6 +227,16 @@ struct vcpu_register_time_memory_area { >> > typedef struct vcpu_register_time_memory_area >> > vcpu_register_time_memory_area_t; >> > DEFINE_XEN_GUEST_HANDLE(vcpu_register_time_memory_area_t); >> > >> > +/* >> > + * Flags to tell Xen whether we need to do the SMAP check when updating >> > + * the secondary copy of the vcpu time when SMAP is enabled. Since the >> > + * memory location for the secondary copy of the vcpu time may be mapped >> > + * into userspace by guests intendedly, we let the guest to determine >> > + * whether the check is needed. The default behavior of hypevisor is >> > + * not doing the check. >> > + */ >> > +#define VCPUOP_enable_smap_check_vcpu_time_memory_area 14 >> >> I think the new op to be VCPUOP_register_vcpu_time_memory_area_smap, >> identical to VCPUOP_register_vcpu_time_memory_area apart from also >> setting the flag, would be more natural. But considering what I just wrote >> in the reply to Tim I guess we can expect a nun-user mapping to be >> presented here anyway, i.e. we wouldn't need to new operation at all. > > Do you mean since the user-paging is r/o, guest will pass a r/w kernel page > to > Xen for updating the system time. So we don't need to do the SMAP check > in this case? If the user page is r/o, it's VA obviously can't be used for updating by Xen. Hence the kernel has to provide a r/w mapped VA. That should be subject to SMAP checking (consistent with the runstate area handling), to make sure it's not a user accessible mapping. Jan