sysv execve remove resource-leaking zipos APE proof of concept

This commit is contained in:
Gavin Hayes 2023-02-04 12:43:43 -05:00
parent 20b75864e6
commit c235065608
2 changed files with 0 additions and 19 deletions

View file

@ -85,13 +85,6 @@ int sys_execve(const char *prog, char *const argv[], char *const envp[]) {
newprog = alloca(PATH_MAX);
fd = _weaken(__zipos_uri_to_mem_file)(&uri, newprog);
prog = newprog;
if ((fd != -1) && IsApeBinary(prog)) {
flags = fcntl(fd, F_GETFD);
if (flags != -1) {
fcntl(fd, F_SETFD, flags & (~FD_CLOEXEC));
flags = fcntl(fd, F_GETFD);
}
}
} else if (IsFreebsd()) {
if ((fd = _weaken(__zipos_uri_to_mem_file)(&uri, NULL)) != -1) {
return sys_fexecve(fd, argv, envp);

View file

@ -72,15 +72,3 @@ TEST(execve, ziposELF) {
notpossible;
EXITS(42);
}
TEST(execve, ziposAPE) {
if (!IsLinux()) {
EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0},
(char *const[]){0}));
return;
}
SPAWN(fork);
execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0});
notpossible;
EXITS(42);
}