From: "Jan Beulich" Subject: Re: [PATCH v4 1/2] x86/hvm: Always do SMAP check when updating runstate_guest(v) Date: Wed, 30 Jul 2014 09:15:24 +0100 Message-ID: <53D8C5BC02000078000278B7@mail.emea.novell.com> References: <1406684152-16820-1-git-send-email-feng.wu@intel.com> <1406684152-16820-2-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406684152-16820-2-git-send-email-feng.wu@intel.com> 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 30.07.14 at 03:35, wrote: > @@ -1349,22 +1357,33 @@ static void paravirt_ctxt_switch_to(struct vcpu *v) > } > > /* Update per-VCPU guest runstate shared memory area (if registered). */ > -bool_t update_runstate_area(const struct vcpu *v) > +bool_t update_runstate_area(struct vcpu *v) > { > + bool_t rc; > + smap_check_policy_t smap_policy; > + > if ( guest_handle_is_null(runstate_guest(v)) ) > return 1; > > + smap_policy = smap_policy_change(v, SMAP_CHECK_ENABLED); > + > if ( has_32bit_shinfo(v->domain) ) > { > struct compat_vcpu_runstate_info info; > > XLAT_vcpu_runstate_info(&info, &v->runstate); > __copy_to_guest(v->runstate_guest.compat, &info, 1); > - return 1; > + smap_policy_change(v, smap_policy); > + rc = 1; > + } > + else > + { > + rc = __copy_to_guest(runstate_guest(v), &v->runstate, 1) != > + sizeof(v->runstate); > + smap_policy_change(v, smap_policy); > } The common smap_policy_change(v, smap_policy) should have been pulled out of the if and else parts. I'll see to remember doing this when committing (assuming that not other issue with the patch gets spotted by someone else). Jan