From 35d2d582a493af2b916584806da819d376c41633 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Thu, 23 Feb 2017 08:36:32 +0100 Subject: [PATCH] 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 --- .../base/src/core/include/cpu_thread_component.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/repos/base/src/core/include/cpu_thread_component.h b/repos/base/src/core/include/cpu_thread_component.h index c4e2376019..ae0392a5bf 100644 --- a/repos/base/src/core/include/cpu_thread_component.h +++ b/repos/base/src/core/include/cpu_thread_component.h @@ -154,8 +154,19 @@ class Genode::Cpu_thread_component : public Rpc_object, { _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); }