mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
config: deal gracefully with invalid dataspace cap
In scenarios where the config ROM is loaded from a report ROM or any other non-static ROM, config might try to access an invalid dataspace capability. This patch prevents the component from aborting in this case. Fixes #1914
This commit is contained in:
parent
07e10a04f9
commit
febb0cc13d
@ -17,6 +17,9 @@ using namespace Genode;
|
|||||||
|
|
||||||
Xml_node _config_xml_node(Dataspace_capability config_ds)
|
Xml_node _config_xml_node(Dataspace_capability config_ds)
|
||||||
{
|
{
|
||||||
|
if (!config_ds.valid())
|
||||||
|
throw Exception();
|
||||||
|
|
||||||
return Xml_node(env()->rm_session()->attach(config_ds),
|
return Xml_node(env()->rm_session()->attach(config_ds),
|
||||||
Genode::Dataspace_client(config_ds).size());
|
Genode::Dataspace_client(config_ds).size());
|
||||||
}
|
}
|
||||||
@ -88,6 +91,8 @@ Config *Genode::config()
|
|||||||
PERR("Could not obtain config file");
|
PERR("Could not obtain config file");
|
||||||
} catch (Genode::Xml_node::Invalid_syntax) {
|
} catch (Genode::Xml_node::Invalid_syntax) {
|
||||||
PERR("Config file has invalid syntax");
|
PERR("Config file has invalid syntax");
|
||||||
|
} catch(...) {
|
||||||
|
PERR("Config dataspace is invalid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* do not try again to construct 'config_inst' */
|
/* do not try again to construct 'config_inst' */
|
||||||
|
Loading…
Reference in New Issue
Block a user