mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-01 15:10:56 +00:00
base-nova: fix core virtual memory region leak
Revert the core-local mapping created in 'Ram_session_component::_clear_ds()' and free the virtual memory region allocated for this mapping when a RAM dataspace gets freed. Fixes #416.
This commit is contained in:
parent
7ee4b75156
commit
6c25ced5f2
@ -36,9 +36,6 @@ Core_rm_session::attach(Dataspace_capability ds_cap, size_t size,
|
|||||||
if (!ds)
|
if (!ds)
|
||||||
throw Invalid_dataspace();
|
throw Invalid_dataspace();
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
size = ds->size();
|
|
||||||
|
|
||||||
if (use_local_addr) {
|
if (use_local_addr) {
|
||||||
PERR("Parameter 'use_local_addr' not supported within core");
|
PERR("Parameter 'use_local_addr' not supported within core");
|
||||||
return 0UL;
|
return 0UL;
|
||||||
|
@ -37,7 +37,15 @@ namespace Genode {
|
|||||||
Local_addr local_addr = 0,
|
Local_addr local_addr = 0,
|
||||||
bool executable = false);
|
bool executable = false);
|
||||||
|
|
||||||
void detach(Local_addr) { }
|
void detach(Local_addr)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The core-local mapping gets established in
|
||||||
|
* 'Ram_session_component::_clear_ds()' and reverted in
|
||||||
|
* 'Ram_session_component::_revoke_ram_ds(), so there's
|
||||||
|
* nothing to do here.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
Pager_capability add_client(Thread_capability thread) {
|
Pager_capability add_client(Thread_capability thread) {
|
||||||
return Pager_capability(); }
|
return Pager_capability(); }
|
||||||
|
@ -29,7 +29,20 @@ enum { verbose_ram_ds = false };
|
|||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
void Ram_session_component::_export_ram_ds(Dataspace_component *ds) { }
|
void Ram_session_component::_export_ram_ds(Dataspace_component *ds) { }
|
||||||
void Ram_session_component::_revoke_ram_ds(Dataspace_component *ds) { }
|
|
||||||
|
void Ram_session_component::_revoke_ram_ds(Dataspace_component *ds)
|
||||||
|
{
|
||||||
|
size_t page_rounded_size = (ds->size() + get_page_size() - 1) & get_page_mask();
|
||||||
|
|
||||||
|
unmap_local((Nova::Utcb *)Thread_base::myself()->utcb(),
|
||||||
|
ds->core_local_addr(),
|
||||||
|
page_rounded_size >> get_page_size_log2());
|
||||||
|
|
||||||
|
platform()->region_alloc()->free((void*)ds->core_local_addr(),
|
||||||
|
page_rounded_size);
|
||||||
|
|
||||||
|
ds->assign_core_local_addr(0);
|
||||||
|
}
|
||||||
|
|
||||||
void Ram_session_component::_clear_ds(Dataspace_component *ds)
|
void Ram_session_component::_clear_ds(Dataspace_component *ds)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user