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

Re: [Xen-devel] [PATCH 13/20] arch/x86: Add missing domctl and mem_sharing XSM hooks



The patch looks good but I have one concern. In the hunk below you dropped the 
cd->is_dying check.
Andres

> diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
> index 5103285..395d302 100644
> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -34,6 +34,7 @@
>  #include <asm/atomic.h>
>  #include <xen/rcupdate.h>
>  #include <asm/event.h>
> +#include <xsm/xsm.h>
>  
>  #include "mm-locks.h"
>  
> @@ -1345,11 +1346,18 @@ int mem_sharing_memop(struct domain *d, 
> xen_mem_sharing_op_t *mec)
>              if ( !mem_sharing_enabled(d) )
>                  return -EINVAL;
>  
> -            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
> +            cd = rcu_lock_domain_by_any_id(mec->u.share.client_domain);
>              if ( !cd )
> +                return -ESRCH;
> +
> +            rc = xsm_mem_sharing_op(d, cd, mec->op);
> +            if ( rc )
> +            {
> +                rcu_unlock_domain(cd);
>                  return rc;
> +            }
>  
> -            if ( !mem_sharing_enabled(cd) )
> +            if ( cd == current->domain || !mem_sharing_enabled(cd) )
>              {
>                  rcu_unlock_domain(cd);
>                  return -EINVAL;
> @@ -1401,11 +1409,18 @@ int mem_sharing_memop(struct domain *d, 
> xen_mem_sharing_op_t *mec)
>              if ( !mem_sharing_enabled(d) )
>                  return -EINVAL;
>  
> -            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
> +            cd = rcu_lock_domain_by_any_id(mec->u.share.client_domain);
>              if ( !cd )
> +                return -ESRCH;
> +
> +            rc = xsm_mem_sharing_op(d, cd, mec->op);
> +            if ( rc )
> +            {
> +                rcu_unlock_domain(cd);
>                  return rc;
> +            }
>  
> -            if ( !mem_sharing_enabled(cd) )
> +            if ( cd == current->domain || !mem_sharing_enabled(cd) )
>              {
>                  rcu_unlock_domain(cd);
>                  return -EINVAL;
> 


_______________________________________________
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®.