From d5518aa5a250e7bb053ba0b8b0c21b4a60e3f0c1 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 19 Mar 2020 16:53:22 +0100 Subject: [PATCH] base-hw: let upgrade_cap_slab reflect Out_of_caps This patch reflects the Out_of_caps exception from core to the client, in addition to the already covered Out_of_ram exception. It thereby eliminates a potential abort in core, which I observed with the tool_chain_auto.run script: Kernel: RPC upgrade_cap_slab Error: Uncaught exception of type 'Genode::Quota_guard::Limit_exceeded' Warning: abort called - thread: entrypoint In addition to propagating the exception, the patch add the client-side exception-handling code to the base library. Fixes #3703 --- repos/base-hw/include/hw_native_pd/hw_native_pd.h | 2 +- repos/base-hw/src/lib/base/env_deprecated.cc | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/repos/base-hw/include/hw_native_pd/hw_native_pd.h b/repos/base-hw/include/hw_native_pd/hw_native_pd.h index 026b41a74..845c45fd3 100644 --- a/repos/base-hw/include/hw_native_pd/hw_native_pd.h +++ b/repos/base-hw/include/hw_native_pd/hw_native_pd.h @@ -30,7 +30,7 @@ struct Genode::Hw_native_pd : Pd_session::Native_pd *********************/ GENODE_RPC_THROW(Rpc_upgrade_cap_slab, void, upgrade_cap_slab, - GENODE_TYPE_LIST(Out_of_ram)); + GENODE_TYPE_LIST(Out_of_ram, Out_of_caps)); GENODE_RPC_INTERFACE(Rpc_upgrade_cap_slab); }; diff --git a/repos/base-hw/src/lib/base/env_deprecated.cc b/repos/base-hw/src/lib/base/env_deprecated.cc index e061ab098..1c9858030 100644 --- a/repos/base-hw/src/lib/base/env_deprecated.cc +++ b/repos/base-hw/src/lib/base/env_deprecated.cc @@ -61,13 +61,20 @@ void Genode::upgrade_capability_slab() return; } - retry( + retry( [&] () { - Genode::Hw_native_pd_client pd(native_pd_cap); - pd.upgrade_cap_slab(); + retry( + [&] () { + Genode::Hw_native_pd_client pd(native_pd_cap); + pd.upgrade_cap_slab(); + }, + [&] () { + internal_env().upgrade(Parent::Env::pd(), + String<100>("ram_quota=", 8192).string()); + }); }, [&] () { internal_env().upgrade(Parent::Env::pd(), - String<100>("ram_quota=", 8192).string()); + String<100>("cap_quota=", 2).string()); }); }