From 6c7661ed622171d7e85a82df5557c51117fcd921 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 4 Feb 2013 15:33:57 +0100 Subject: [PATCH] base: fix sporadic context thread area faults reverts 68156918ee5ee8150f11f5403439582dda0b9bb3 "base: apply thread.cc fix of foc to base" Depending on the context area a fixed location is calculated where the memory for the stack is attached to. If the context area is released before the detach call, the very same context area can be reused and memory for the new stack is attached for a new thread. The detach of the old thread would then revoke the mapping for the new thread which will cause a un-handled page fault. Issue #549 --- base-mb/src/base/thread/thread.cc | 2 +- base/src/base/thread/thread.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base-mb/src/base/thread/thread.cc b/base-mb/src/base/thread/thread.cc index bf99c712f2..4ac8af919c 100644 --- a/base-mb/src/base/thread/thread.cc +++ b/base-mb/src/base/thread/thread.cc @@ -164,9 +164,9 @@ void Thread_base::_free_context() { addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base(); Ram_dataspace_capability ds_cap = _context->ds_cap; - _context_allocator()->free(this); Genode::env_context_area_rm_session()->detach((void *)ds_addr); Genode::env_context_area_ram_session()->free(ds_cap); + _context_allocator()->free(this); } diff --git a/base/src/base/thread/thread.cc b/base/src/base/thread/thread.cc index d96982fd24..5df8097537 100644 --- a/base/src/base/thread/thread.cc +++ b/base/src/base/thread/thread.cc @@ -163,9 +163,9 @@ void Thread_base::_free_context() { addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base(); Ram_dataspace_capability ds_cap = _context->ds_cap; - _context_allocator()->free(this); Genode::env_context_area_rm_session()->detach((void *)ds_addr); Genode::env_context_area_ram_session()->free(ds_cap); + _context_allocator()->free(this); }