core: handle out-of-memory in RM service

This patch adds the missing exception handling for depleted RM session
quotas. If core runs out of session quota while creating a new region
map, it now reflects this condition as a Region_map::Out_of_metadata
exception to the RM client. Thanks to Denis Huber for reporting the
issue!
This commit is contained in:
Norman Feske
2016-08-25 16:55:12 +02:00
committed by Christian Helmuth
parent dc26910fc3
commit fac69eff48

View File

@ -77,6 +77,7 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
{ {
Lock::Guard guard(_region_maps_lock); Lock::Guard guard(_region_maps_lock);
try {
Region_map_component *rm = Region_map_component *rm =
new (_md_alloc) new (_md_alloc)
Region_map_component(_ep, _md_alloc, _pager_ep, 0, size); Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
@ -85,6 +86,8 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
return rm->cap(); return rm->cap();
} }
catch (Allocator::Out_of_memory) { throw Out_of_metadata(); }
}
void destroy(Capability<Region_map> rm) override void destroy(Capability<Region_map> rm) override
{ {