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

Re: [Xen-devel] [PATCH v2 2/2] x86/mm: fix a potential race condition in modify_xen_mappings().



>>> On 10.11.17 at 08:18, <yu.c.zhang@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -5097,6 +5097,17 @@ int modify_xen_mappings(unsigned long s, unsigned long 
> e, unsigned int nf)
>               */
>              if ( (nf & _PAGE_PRESENT) || ((v != e) && (l1_table_offset(v) != 
> 0)) )
>                  continue;
> +            if ( locking )
> +                spin_lock(&map_pgdir_lock);
> +
> +            /* L2E may be cleared on another CPU. */
> +            if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )

I think you also need a PSE check here, or else the l2e_to_l1e() below
may be illegal.

> @@ -5105,11 +5116,16 @@ int modify_xen_mappings(unsigned long s, unsigned 
> long e, unsigned int nf)
>              {
>                  /* Empty: zap the L2E and free the L1 page. */
>                  l2e_write_atomic(pl2e, l2e_empty());
> +                if ( locking )
> +                    spin_unlock(&map_pgdir_lock);
>                  flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
>                  free_xen_pagetable(pl1e);
>              }
> +            else if ( locking )
> +                spin_unlock(&map_pgdir_lock);
>          }
>  
> +check_l3:

Labels indented by at least one space please.

Jan


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

 


Rackspace

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