All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Feng Wu <feng.wu@intel.com>
Cc: jun.nakajima@intel.com, eddie.dong@intel.com,
	Ian.Campbell@citrix.com, JBeulich@suse.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v1 3/6] x86: Enable Supervisor Mode Execution Prevention (SMAP) for Xen
Date: Tue, 15 Apr 2014 15:00:39 +0100	[thread overview]
Message-ID: <534D3B87.7030109@citrix.com> (raw)
In-Reply-To: <1397566907-19710-1-git-send-email-feng.wu@intel.com>

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

  parent reply	other threads:[~2014-04-15 14:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 13:01 [PATCH v1 3/6] x86: Enable Supervisor Mode Execution Prevention (SMAP) for Xen Feng Wu
2014-04-15  5:36 ` Wu, Feng
2014-04-15 10:32 ` Andrew Cooper
2014-04-15 11:48   ` Jan Beulich
2014-04-15 13:46     ` Andrew Cooper
2014-04-16  2:20   ` Wu, Feng
2014-04-16  9:10     ` Andrew Cooper
2014-04-16  9:14       ` Jan Beulich
2014-04-15 14:00 ` Andrew Cooper [this message]
2014-04-15 14:09   ` Andrew Cooper
2014-04-15 14:16     ` Jan Beulich
2014-04-15 14:26       ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534D3B87.7030109@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=eddie.dong@intel.com \
    --cc=feng.wu@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.