From 22084dbfa58cad645b3692ca4e6135cb45cb7613 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 23 Mar 2012 17:22:49 +0100 Subject: [PATCH] Ignore suspicious wake-up messages on OKL4 --- base-okl4/include/base/ipc_pager.h | 6 ++++++ base-okl4/src/base/ipc/pager.cc | 1 + base-okl4/src/base/pager/pager.cc | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/base-okl4/include/base/ipc_pager.h b/base-okl4/include/base/ipc_pager.h index f63a789253..8316b53ee1 100644 --- a/base-okl4/include/base/ipc_pager.h +++ b/base-okl4/include/base/ipc_pager.h @@ -77,6 +77,7 @@ namespace Genode { Okl4::L4_MsgTag_t _faulter_tag; /* fault flags */ Okl4::L4_ThreadId_t _last; /* faulted thread */ + Okl4::L4_Word_t _last_space; /* space of faulted thread */ Okl4::L4_Word_t _fault_addr; /* page-fault address */ Okl4::L4_Word_t _fault_ip; /* instruction pointer of faulter */ Mapping _reply_mapping; /* page-fault answer */ @@ -148,6 +149,11 @@ namespace Genode { */ Native_thread_id last() const { return _last; } + /** + * Return address space where the last page fault occurred + */ + unsigned long last_space() const { return _last_space; } + /** * Return badge for faulting thread * diff --git a/base-okl4/src/base/ipc/pager.cc b/base-okl4/src/base/ipc/pager.cc index 7d97d1ca8f..f78d2ba3f3 100644 --- a/base-okl4/src/base/ipc/pager.cc +++ b/base-okl4/src/base/ipc/pager.cc @@ -108,6 +108,7 @@ void Ipc_pager::wait_for_fault() if (verbose_page_fault) print_page_fault(L4_Label(_faulter_tag), _fault_addr, _fault_ip, _last.raw); } + _last_space = L4_SenderSpace().raw; } diff --git a/base-okl4/src/base/pager/pager.cc b/base-okl4/src/base/pager/pager.cc index 79a0ea1457..51c1ef4c37 100644 --- a/base-okl4/src/base/pager/pager.cc +++ b/base-okl4/src/base/pager/pager.cc @@ -54,14 +54,16 @@ void Pager_activation_base::entry() } else { - /* prevent threads outside of core to mess with our wake-up interface */ -// enum { CORE_TASK_ID = 4 }; -// if (pager.last() != CORE_TASK_ID) { - -#warning Check for messages from outside of core - if (0) { - - } else { + /* + * Prevent threads outside of core to mess with our wake-up + * interface. This condition can trigger if a process gets + * destroyed which triggered a page fault shortly before getting + * killed. In this case, 'wait_for_fault()' returns (because of + * the page fault delivery) but the pager-object lookup will fail + * (because core removed the process already). + */ + enum { CORE_SPACE = 0 }; + if (pager.last_space() == CORE_SPACE) { /* * We got a request from one of cores region-manager sessions