mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-31 22:50:54 +00:00
Detect execve failure
This commit is contained in:
parent
cdbd1630bb
commit
0f6b59097e
@ -254,6 +254,8 @@ namespace Noux {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
struct Binary_does_not_exist : Exception { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -261,6 +263,11 @@ namespace Noux {
|
|||||||
* an executable binary (i.e., the init process,
|
* an executable binary (i.e., the init process,
|
||||||
* or children created via execve, or
|
* or children created via execve, or
|
||||||
* true if the child is a fork from another child
|
* true if the child is a fork from another child
|
||||||
|
*
|
||||||
|
* \throw Binary_does_not_exist if child is not a fork and the
|
||||||
|
* specified name could not be
|
||||||
|
* looked up at the virtual file
|
||||||
|
* system
|
||||||
*/
|
*/
|
||||||
Child(char const *name,
|
Child(char const *name,
|
||||||
Family_member *parent,
|
Family_member *parent,
|
||||||
@ -304,6 +311,11 @@ namespace Noux {
|
|||||||
{
|
{
|
||||||
_env.pwd(pwd);
|
_env.pwd(pwd);
|
||||||
_args.dump();
|
_args.dump();
|
||||||
|
|
||||||
|
if (!forked && !_binary_ds.valid()) {
|
||||||
|
PERR("Lookup of executable \"%s\" failed", name);
|
||||||
|
throw Binary_does_not_exist();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~Child()
|
~Child()
|
||||||
|
@ -224,6 +224,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
|||||||
j += strlen(src);
|
j += strlen(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
Child *child = new Child(absolute_path.base(),
|
Child *child = new Child(absolute_path.base(),
|
||||||
parent(),
|
parent(),
|
||||||
pid(),
|
pid(),
|
||||||
@ -253,6 +254,11 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
|||||||
/* this child will be removed by the execve_finalization_dispatcher */
|
/* this child will be removed by the execve_finalization_dispatcher */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (Child::Binary_does_not_exist) {
|
||||||
|
_sysio->error.execve = Sysio::EXECVE_NONEXISTENT; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
case SYSCALL_SELECT:
|
case SYSCALL_SELECT:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user