From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v1 3/6] x86: Enable Supervisor Mode Execution Prevention (SMAP) for Xen Date: Tue, 15 Apr 2014 15:00:39 +0100 Message-ID: <534D3B87.7030109@citrix.com> References: <1397566907-19710-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: <1397566907-19710-1-git-send-email-feng.wu@intel.com> 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: jun.nakajima@intel.com, eddie.dong@intel.com, Ian.Campbell@citrix.com, JBeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 15/04/14 14:01, Feng Wu wrote: > @@ -1379,8 +1396,8 @@ void do_page_fault(struct cpu_user_regs *regs) > > if ( unlikely(!guest_mode(regs)) ) > { > - pf_type = spurious_page_fault(addr, error_code); > - BUG_ON(pf_type == smep_fault); > + pf_type = spurious_page_fault(addr, regs); > + BUG_ON((pf_type == smep_fault) || (pf_type == smap_fault)); On further consideration, given the nature of faults like these, this code would be better as: if ( (pf_type == smep_fault) || (pf_type == smap_fault) ) { console_start_sync(); printk("Xen SM%cP violation", pf_type == smep_fault ? 'E' : 'A'); fatal_trap(TRAP_page_fault, regs); } This would make the resulting crash crystal clear as to what went wrong, and forgo the first step of having to look up which BUG() tripped. ~Andrew