base: free 'Cpu_free_component' from EP construction fails

It can happen that when Cpu_free_component is constructed the insertion
of the object through 'manage' succeeds for the EP put not for the pager
EP, which in turn raises an Out_of_meta_data exception. Because we are
within the constructor, the descstructor is not called, leading to a
dangling object pool entry for the EP.

issue #2289
This commit is contained in:
Sebastian Sumpf 2017-02-23 08:36:32 +01:00 committed by Christian Helmuth
parent f272637655
commit 35d2d582a4

View File

@ -154,8 +154,19 @@ class Genode::Cpu_thread_component : public Rpc_object<Cpu_thread>,
{
_address_space_region_map.add_client(_rm_client);
/* acquaint thread with its pager object */
_pager_ep.manage(&_rm_client);
/*
* Acquaint thread with its pager object, caution on some base platforms
* this may raise an 'Out_of_meta_data' exception, which causes the
* destructor of this object to not being called. Catch it and remove this
* object from the object pool
*/
try {
_pager_ep.manage(&_rm_client);
} catch (...) {
_ep.dissolve(this);
throw;
}
_platform_thread.pager(&_rm_client);
_trace_sources.insert(&_trace_source);
}