From f407bc4cbb024d52b0201a707159dccad028a3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 24 Feb 2014 11:23:29 +0100 Subject: [PATCH] base: interim forked trace control fix The destructor of the Area object uses invalid caps which results in a wanted abort of the process on nova. This is mainly the case in forked process in noux. --- base/src/base/thread/trace.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/base/src/base/thread/trace.cc b/base/src/base/thread/trace.cc index a19eb157f..921c0660c 100644 --- a/base/src/base/thread/trace.cc +++ b/base/src/base/thread/trace.cc @@ -16,6 +16,7 @@ #include #include #include +#include /* local includes */ #include @@ -64,8 +65,20 @@ static Trace::Control *trace_control(Cpu_session *cpu, Rm_session *rm, } }; - static Area area(*cpu, *rm); - return area.slot(thread_cap); + /** + * We have to construct the Area object explicitly because otherwise + * the destructor may use a invalid capability. This is mainly the + * case by e.g. forked processes in noux. + */ + + static char area_mem[sizeof (Area)]; + static Area *area = 0; + + if (!area) { + area = construct_at(area_mem, *cpu, *rm); + } + + return area->slot(thread_cap); }