[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1 3/6] x86: Enable Supervisor Mode Execution Prevention (SMAP) for Xen



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.