From dae9f9e1649bbb9f543d60176a64d847ac43e2bf Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 14 Jun 2018 11:23:35 +0200 Subject: [PATCH] foc: fix reply_and_wait ipc method Currently, if the target of a reply capability gets destroyed, the ipc syscall reply/wait returns with an error. Although we detect the error condition we continue with reply/wait, which leads to an endless loop. This commit introduces a condition analoque to the base-library for pistachio and fiasco to do an open wait if an error occured during a reply. --- repos/base-foc/src/lib/base/ipc.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/repos/base-foc/src/lib/base/ipc.cc b/repos/base-foc/src/lib/base/ipc.cc index b2171ab5bd..4ae88fec2a 100644 --- a/repos/base-foc/src/lib/base/ipc.cc +++ b/repos/base-foc/src/lib/base/ipc.cc @@ -318,6 +318,8 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &, { Receive_window &rcv_window = Thread::myself()->native_thread().rcv_window; + bool need_to_wait = false; + for (;;) { request_msg.reset(); @@ -333,7 +335,8 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &, l4_msgtag_t request_tag; l4_umword_t label = 0; /* kernel-protected label of invoked capability */ - if (exc.value != Rpc_exception_code::INVALID_OBJECT) { + if (exc.value != Rpc_exception_code::INVALID_OBJECT + && !need_to_wait) { l4_msgtag_t const reply_tag = copy_msgbuf_to_utcb(reply_msg, exc.value); @@ -342,8 +345,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &, request_tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER); } - if (ipc_error(request_tag, false)) + if (ipc_error(request_tag, false)) { + need_to_wait = true; continue; + } else need_to_wait = false; /* copy request message from the UTCBs message registers */ unsigned long const badge =