From: "Jan Beulich" Subject: Re: [PATCH v4 05/10] Clear AC bit in RFLAGS to protect Xen itself by SMAP Date: Mon, 05 May 2014 12:11:04 +0100 Message-ID: <53678DE8020000780000EF75@mail.emea.novell.com> References: <1399278131-6570-1-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: <1399278131-6570-1-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: kevin.tian@intel.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 05.05.14 at 10:22, wrote: > --- a/xen/include/asm-x86/asm_defns.h > +++ b/xen/include/asm-x86/asm_defns.h > @@ -199,7 +199,10 @@ static inline void stac(void) > #endif > > #ifdef __ASSEMBLY__ > -.macro SAVE_ALL > +.macro SAVE_ALL clear_ac=0 > +.if \clear_ac > + ASM_CLAC > +.endif > addq $-(UREGS_error_code-UREGS_r15), %rsp > cld > movq %rdi,UREGS_rdi(%rsp) Considering that an unnecessary CLAC is generally no problem, I think the default value of the macro parameter should be 1, and when the instructions is specifically not needed the use site would pass 0. Jan