From: "Jan Beulich" Subject: Re: [PATCH v3 1/2] x86/hvm: Always do SMAP check when updating runstate_guest(v) Date: Tue, 29 Jul 2014 10:04:46 +0100 Message-ID: <53D77FCE020000780002731D@mail.emea.novell.com> References: <978994327-6622-1-git-send-email-feng.wu@intel.com> <978994327-6622-2-git-send-email-feng.wu@intel.com> <53D7670B02000078000271C0@mail.emea.novell.com> <53D775EC02000078000272B1@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 29.07.14 at 10:42, wrote: > >> -----Original Message----- >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Tuesday, July 29, 2014 4:23 PM >> To: Wu, Feng >> Cc: linux@eikelenboom.it; xen-devel@lists.xen.org; keir@xen.org; >> tim@xen.org >> Subject: RE: [PATCH v3 1/2] x86/hvm: Always do SMAP check when updating >> runstate_guest(v) >> >> >>> On 29.07.14 at 09:54, wrote: >> >> From: Jan Beulich [mailto:JBeulich@suse.com] >> >> >>> On 08.01.01 at 23:52, wrote: >> >> > + switch ( v->arch.smap_check_policy ) >> >> > + { >> >> > + case SMAP_CHECK_HONOR_CPL_AC: >> >> > + hvm_get_segment_register(v, x86_seg_ss, &seg); >> >> > + >> >> > + /* >> >> > + * SMAP: kernel-mode data accesses from user-mode >> >> mappings >> >> > + * should fault. >> >> > + * A fault is considered as a SMAP violation if the following >> >> > + * conditions come true: >> >> > + * - X86_CR4_SMAP is set in CR4 >> >> > + * - A user page is accessed >> >> > + * - CPL = 3 or X86_EFLAGS_AC is clear >> >> > + * - Page fault in kernel mode >> >> > + */ >> >> > + smap = hvm_smap_enabled(v) && >> >> > + ((seg.attr.fields.dpl == 3) || >> >> > + !(regs->eflags & X86_EFLAGS_AC)); >> >> >> >> Indentation. >> > >> > Sorry, I don't find any indentation issue here. Do you mean >> > "((seg.attr.fields.dpl == 3) ||" and "!(regs->eflags & X86_EFLAGS_AC));" >> > are not indented with "hvm_smap_enabled(v) &&"? In fact they are in good >> > indentation. Maybe it is the display that make it look >> > like in wrong indentation? >> >> No, I specifically checked in a mono-spaced font. The parentheses >> around the || expression require its right side to be indented by one >> more space than the very opening parenthesis. > > In this case, do you mean I need to add another space before "!(regs->eflags & > X86_EFLAGS_AC))"? Exactly. Jan