detach ds from all rm sessions before destruction

Fixes #1617
This commit is contained in:
Alexander Boettcher 2015-07-06 13:06:27 +02:00 committed by Norman Feske
parent bc8a5cbb2a
commit c42e770384
5 changed files with 19 additions and 6 deletions

View File

@ -98,6 +98,11 @@ namespace Genode {
*/
bool owner(Dataspace_owner * const o) const { return _owner == o; }
/**
* Detach dataspace from all rm sessions.
*/
void detach_from_rm_sessions() { }
/*************************
** Dataspace interface **
*************************/

View File

@ -43,8 +43,6 @@ void Ram_session_component::_revoke_ram_ds(Dataspace_component *ds)
platform()->region_alloc()->free((void*)ds->core_local_addr(),
page_rounded_size);
ds->assign_core_local_addr(0);
}

View File

@ -31,8 +31,7 @@ void Dataspace_component::detached_from(Rm_region *region)
_regions.remove(region);
}
Dataspace_component::~Dataspace_component()
void Dataspace_component::detach_from_rm_sessions()
{
_lock.lock();
@ -50,3 +49,8 @@ Dataspace_component::~Dataspace_component()
_lock.unlock();
}
Dataspace_component::~Dataspace_component()
{
detach_from_rm_sessions();
}

View File

@ -140,6 +140,11 @@ namespace Genode {
void attached_to(Rm_region *region);
void detached_from(Rm_region *region);
/**
* Detach dataspace from all rm sessions.
*/
void detach_from_rm_sessions();
/**
* Check if dataspace is owned by a specific owner
*/

View File

@ -42,11 +42,12 @@ void Ram_session_component::_free_ds(Dataspace_component *ds)
/* tell entry point to forget the dataspace */
_ds_ep->dissolve(ds);
/* remove dataspace from all RM sessions */
ds->detach_from_rm_sessions();
/* destroy native shared memory representation */
_revoke_ram_ds(ds);
/* XXX: remove dataspace from all RM sessions */
/* free physical memory that was backing the dataspace */
_ram_alloc->free((void *)ds->phys_addr(), ds_size);