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.
This commit is contained in:
Josef Söntgen 2014-02-24 11:23:29 +01:00 committed by Christian Helmuth
parent e7f370f779
commit f407bc4cbb

View File

@ -16,6 +16,7 @@
#include <base/thread.h>
#include <base/trace/policy.h>
#include <dataspace/client.h>
#include <util/construct_at.h>
/* local includes */
#include <trace/control.h>
@ -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>(area_mem, *cpu, *rm);
}
return area->slot(thread_cap);
}