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<Genode::Cap_quota>::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
This commit is contained in:
Norman Feske 2020-03-19 16:53:22 +01:00
parent 5c448e0f0e
commit d5518aa5a2
2 changed files with 12 additions and 5 deletions

View File

@ -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);
};

View File

@ -61,13 +61,20 @@ void Genode::upgrade_capability_slab()
return;
}
retry<Genode::Out_of_ram>(
retry<Genode::Out_of_caps>(
[&] () {
Genode::Hw_native_pd_client pd(native_pd_cap);
pd.upgrade_cap_slab();
retry<Genode::Out_of_ram>(
[&] () {
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());
});
}