From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: kevin.tian@intel.com, Feng Wu <feng.wu@intel.com>,
ian.campbell@citrix.com, eddie.dong@intel.com,
xen-devel@lists.xen.org, jun.nakajima@intel.com
Subject: Re: [PATCH v3 7/9] x86: Enable Supervisor Mode Access Prevention (SMAP) for Xen
Date: Mon, 28 Apr 2014 10:48:15 +0100 [thread overview]
Message-ID: <535E23DF.3090903@citrix.com> (raw)
In-Reply-To: <535E3E45020000780000CC51@nat28.tlf.novell.com>
On 28/04/14 10:40, Jan Beulich wrote:
>>>> On 28.04.14 at 05:17, <feng.wu@intel.com> wrote:
>> @@ -1394,6 +1398,15 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>> bootstrap_map, cmdline) != 0)
>> panic("Could not set up DOM0 guest OS");
>>
>> + /*
>> + * Enable SMAP after constructing domain0, since there are lots of accesses to
>> + * user pages in construct_dom0(), which is safe at the current stage.
>> + */
>> + if ( disable_smap )
>> + setup_clear_cpu_cap(X86_FEATURE_SMAP);
> You should not have moved this part - this should happen before APs
> get brought up.
>
>> @@ -1379,8 +1399,14 @@ 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);
>> + if ( (pf_type == smep_fault) || (pf_type == smap_fault) )
>> + {
>> + console_start_sync();
>> + printk("Xen %s violation\n", (pf_type == smep_fault) ? "SMEP" : "SMAP");
> I know it's largely a matter of taste, but could I talk you into doing
>
> printk("Xen SM%cP violation\n", (pf_type == smep_fault) ? 'E' : 'A');
>
> instead (unless others object)?
I concur. Neither string is grepable.
>
>> @@ -1406,10 +1432,12 @@ void do_page_fault(struct cpu_user_regs *regs)
>>
>> if ( unlikely(current->domain->arch.suppress_spurious_page_faults) )
>> {
>> - pf_type = spurious_page_fault(addr, error_code);
>> - if ( pf_type == smep_fault )
>> + pf_type = spurious_page_fault(addr, regs);
>> + if ( (pf_type == smep_fault) || (pf_type == smap_fault))
>> {
>> - gdprintk(XENLOG_ERR, "Fatal SMEP fault\n");
>> + printk(XENLOG_G_ERR "%p fatal %s fault\n",
>> + current, (pf_type == smep_fault) ? "SMEP" : "SMAP");
That should be %pv rather than %p, which is an automagic format
parameter which will get you "d<domid>v<vcpuid>" formatted.
> And similarly here then?
>
> Jan
>
~Andrew
next prev parent reply other threads:[~2014-04-28 9:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 3:17 [PATCH v3 7/9] x86: Enable Supervisor Mode Access Prevention (SMAP) for Xen Feng Wu
2014-04-28 9:40 ` Jan Beulich
2014-04-28 9:48 ` Andrew Cooper [this message]
2014-04-28 9:50 ` Wu, Feng
2014-04-28 9:53 ` Andrew Cooper
2014-04-28 9:54 ` Wu, Feng
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=535E23DF.3090903@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=feng.wu@intel.com \
--cc=ian.campbell@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@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.