sel4: handle unmap error more gracefully

Issue #2505
This commit is contained in:
Alexander Boettcher 2017-08-24 11:53:19 +02:00 committed by Christian Helmuth
parent 9094517809
commit bcfcc1db9c
3 changed files with 12 additions and 6 deletions

View File

@ -56,8 +56,7 @@ namespace Genode {
Platform * platform = nullptr)
{
platform = platform ? platform : platform_specific();
platform->core_vm_space().unmap(virt_addr, num_pages);
return true;
return platform->core_vm_space().unmap(virt_addr, num_pages);
}
}

View File

@ -388,11 +388,13 @@ class Genode::Vm_space
}
}
void unmap(addr_t virt, size_t num_pages)
bool unmap(addr_t virt, size_t num_pages)
{
bool unmap_success = true;
Lock::Guard guard(_lock);
for (size_t i = 0; i < num_pages; i++) {
for (size_t i = 0; unmap_success && i < num_pages; i++) {
off_t const offset = i << get_page_size_log2();
_page_table_registry.flush_page(virt + offset, [&] (Cap_sel const &idx, addr_t) {
@ -401,7 +403,7 @@ class Genode::Vm_space
if (result != seL4_NoError) {
error("unmap ", Hex(virt + offset), " failed, idx=",
idx, " result=", result);
return;
unmap_success = false;
}
_leaf_cnode(idx.value()).remove(_leaf_cnode_entry(idx.value()));
@ -409,6 +411,7 @@ class Genode::Vm_space
_sel_alloc.free(idx.value());
});
}
return unmap_success;
}
void unsynchronized_alloc_page_tables(addr_t const start,

View File

@ -121,7 +121,11 @@ static void prepopulate_ipc_buffer(addr_t ipc_buffer_phys, Cap_sel ep_sel,
utcb.lock_sel = lock_sel.value();
/* unmap IPC buffer from core */
unmap_local((addr_t)virt_addr, 1);
if (!unmap_local((addr_t)virt_addr, 1)) {
Genode::error("could not unmap core virtual address ",
virt_addr, " in ", __PRETTY_FUNCTION__);
return;
}
/* free core's virtual address space */
platform()->region_alloc()->free(virt_addr, page_rounded_size);