}
save_process_cmd(proc, argv);
+ container->inode = executable->inode;
errno = load_executable(&container->exe, executable);
if (errno) {
goto done;
}
- if ((errno = vfs_open(dnode, &file))) {
+ if (!check_allow_execute(dnode->inode)) {
+ errno = EPERM;
goto done;
}
errno = EISDIR;
goto done;
}
+
+ if ((errno = vfs_open(dnode, &file))) {
+ goto done;
+ }
errno = exec_load(container, file);
return errno;
}
-__DEFINE_LXSYSCALL3(int,
- execve,
- const char*,
- filename,
- const char*,
- argv[],
- const char*,
- envp[])
+__DEFINE_LXSYSCALL3(int, execve, const char*, filename,
+ const char*, argv[], const char*, envp[])
{
int errno = 0;
+ int acl;
struct exec_host container;
if (!argv || !envp) {
signal_reset_context(¤t_thread->sigctx);
signal_reset_registry(__current->sigreg);
+ acl = container.inode->acl;
+ if (fsacl_test(acl, suid)) {
+ current_set_euid(container.inode->uid);
+ }
+
+ if (fsacl_test(acl, sgid)) {
+ current_set_egid(container.inode->gid);
+ }
+
done:
// set return value
store_retval(DO_STATUS(errno));
// Always yield the process that want execve!
schedule();
- // this will never get executed!
- return -1;
+ unreachable;
}
\ No newline at end of file