[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 08/18] xen: Add DOMID_SELF support to rcu_lock_domain_by_id
>>> On 06.08.12 at 16:32, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> wrote: > Callers that want to prevent use of DOMID_SELF already need to ensure > the calling domain does not pass its own domain ID. This removes the > need for the caller to manually support DOMID_SELF, which many already > do. I'm not really sure this is correct. At the very least it changes the return value of rcu_lock_remote_target_domain_by_id() when called with DOMID_SELF (from -ESRCH to -EPERM). I'm also not convinced that a distinction between a domain knowing its ID and one passing DOMID_SELF isn't/can't be useful. That of course depends on whether the ID can be fully hidden from a guest (obviously pure HVM guests would never know their ID, but then again they also would never pass DOMID_SELF anywhere; it might be, however, that they could get the latter passed on their behalf e.g. from some emulation function). Jan > Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> > --- > xen/common/domain.c | 3 +++ > xen/common/event_channel.c | 3 --- > xen/common/grant_table.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/xen/common/domain.c b/xen/common/domain.c > index 4c5d241..dbbc414 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -400,6 +400,9 @@ struct domain *rcu_lock_domain_by_id(domid_t dom) > { > struct domain *d = NULL; > > + if ( dom == DOMID_SELF ) > + return rcu_lock_current_domain(); > + > rcu_read_lock(&domlist_read_lock); > > for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]); > diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c > index 53777f8..988d3ce 100644 > --- a/xen/common/event_channel.c > +++ b/xen/common/event_channel.c > @@ -201,9 +201,6 @@ static long > evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind) > domid_t rdom = bind->remote_dom; > long rc; > > - if ( rdom == DOMID_SELF ) > - rdom = current->domain->domain_id; > - > if ( (rd = rcu_lock_domain_by_id(rdom)) == NULL ) > return -ESRCH; > > diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c > index 9961e83..fbea67c 100644 > --- a/xen/common/grant_table.c > +++ b/xen/common/grant_table.c > @@ -715,7 +715,7 @@ __gnttab_map_grant_ref( > TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom); > > mt = &maptrack_entry(lgt, handle); > - mt->domid = op->dom; > + mt->domid = rd->domain_id; > mt->ref = op->ref; > mt->flags = op->flags; > > -- > 1.7.11.2 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |