From f0c4fc1e2241a7640bfbfe35175a194d7e872ff6 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 21 Apr 2020 13:07:55 +0200 Subject: [PATCH] sandbox: defer requests for upcoming server The sandbox library supports the forwarding of session requests from the outside to one of the hosted children according to a policy. This patch introduces the distinction between two cases, which previously triggered the denial of the session request. - There exists no matching policy for the requested session - There exists a matching policy but the referred server child does not exist (yet) Whereas the proper response to the first case is the denial of the request, the second case can occur in situation where a dynamic init is used to implement a staged startup, for example via the deploy mechanism. In such cases, a policy may exist as a static rule while the server has not been started yet. This patch changes the behavior such that such requests are stalled. The patch is accompanied with test cases for exercising both situations. Fixes #3733 --- .../os/recipes/raw/test-init/test-init.config | 126 +++++++++++++++++- repos/os/src/lib/sandbox/server.cc | 2 +- 2 files changed, 123 insertions(+), 5 deletions(-) diff --git a/repos/os/recipes/raw/test-init/test-init.config b/repos/os/recipes/raw/test-init/test-init.config index c744cd9f9..faac1a84c 100644 --- a/repos/os/recipes/raw/test-init/test-init.config +++ b/repos/os/recipes/raw/test-init/test-init.config @@ -1203,7 +1203,125 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1360,11 +1478,11 @@ - + - + @@ -1395,7 +1513,7 @@ - + diff --git a/repos/os/src/lib/sandbox/server.cc b/repos/os/src/lib/sandbox/server.cc index e5a83d299..f240f18e2 100644 --- a/repos/os/src/lib/sandbox/server.cc +++ b/repos/os/src/lib/sandbox/server.cc @@ -86,7 +86,7 @@ Sandbox::Server::Service::resolve_session_request(Session_label const &label) match = &service; }); if (!match || match->abandoned()) - throw Service_denied(); + throw Service_not_present(); return Route { *match, target_label }; }