mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add fixups for previous change
This commit is contained in:
parent
3c92adfd6e
commit
5297897ba1
47 changed files with 68 additions and 15 deletions
|
@ -36,7 +36,7 @@
|
||||||
* `ape/ape.S` bootloader embeds this binary inside each binary that's
|
* `ape/ape.S` bootloader embeds this binary inside each binary that's
|
||||||
* linked using `$(APE_NO_MODIFY_SELF)` so it is an automated seamless
|
* linked using `$(APE_NO_MODIFY_SELF)` so it is an automated seamless
|
||||||
* process. the shell script at the top of the .COM files will copy it
|
* process. the shell script at the top of the .COM files will copy it
|
||||||
* to `${TMPDIR:-/tmp}/ape` and call execve(). It's a zero copy
|
* to `${TMPDIR:-${HOME:-.}}/.ape` and call execve(). It's a zero copy
|
||||||
* operation in praxis since this payload uses mmap() to load the rest
|
* operation in praxis since this payload uses mmap() to load the rest
|
||||||
* of your executable the same way the kernel does, based on ELF phdrs
|
* of your executable the same way the kernel does, based on ELF phdrs
|
||||||
* which are located in accordance with the first sh printf statement.
|
* which are located in accordance with the first sh printf statement.
|
||||||
|
|
|
@ -75,8 +75,9 @@ int sys_execve(const char *prog, char *const argv[], char *const envp[]) {
|
||||||
shargs = alloca((i + 4) * sizeof(char *));
|
shargs = alloca((i + 4) * sizeof(char *));
|
||||||
if (IsApeBinary(prog) &&
|
if (IsApeBinary(prog) &&
|
||||||
(CanExecute((ape = "/usr/bin/ape")) ||
|
(CanExecute((ape = "/usr/bin/ape")) ||
|
||||||
CanExecute(
|
CanExecute((ape = Join(firstnonnull(getenv("TMPDIR"),
|
||||||
(ape = Join(firstnonnull(getenv("TMPDIR"), "/tmp"), "ape", buf))))) {
|
firstnonnull(getenv("HOME"), ".")),
|
||||||
|
".ape", buf))))) {
|
||||||
shargs[0] = ape;
|
shargs[0] = ape;
|
||||||
shargs[1] = "-";
|
shargs[1] = "-";
|
||||||
shargs[2] = prog;
|
shargs[2] = prog;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "libc/calls/struct/filter.h"
|
#include "libc/calls/struct/filter.h"
|
||||||
#include "libc/calls/struct/seccomp.h"
|
#include "libc/calls/struct/seccomp.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
@ -64,10 +65,12 @@ static const uint16_t kPledgeLinuxStdio[] = {
|
||||||
__NR_linux_writev, //
|
__NR_linux_writev, //
|
||||||
__NR_linux_pwrite, //
|
__NR_linux_pwrite, //
|
||||||
__NR_linux_pwritev, //
|
__NR_linux_pwritev, //
|
||||||
|
__NR_linux_pwritev2, //
|
||||||
__NR_linux_read, //
|
__NR_linux_read, //
|
||||||
__NR_linux_readv, //
|
__NR_linux_readv, //
|
||||||
__NR_linux_pread, //
|
__NR_linux_pread, //
|
||||||
__NR_linux_preadv, //
|
__NR_linux_preadv, //
|
||||||
|
__NR_linux_preadv2, //
|
||||||
__NR_linux_dup, //
|
__NR_linux_dup, //
|
||||||
__NR_linux_dup2, //
|
__NR_linux_dup2, //
|
||||||
__NR_linux_dup3, //
|
__NR_linux_dup3, //
|
||||||
|
@ -96,12 +99,16 @@ static const uint16_t kPledgeLinuxStdio[] = {
|
||||||
__NR_linux_getitimer, //
|
__NR_linux_getitimer, //
|
||||||
__NR_linux_setitimer, //
|
__NR_linux_setitimer, //
|
||||||
__NR_linux_gettimeofday, //
|
__NR_linux_gettimeofday, //
|
||||||
|
__NR_linux_copy_file_range, //
|
||||||
|
__NR_linux_splice, //
|
||||||
__NR_linux_lseek, //
|
__NR_linux_lseek, //
|
||||||
|
__NR_linux_tee, //
|
||||||
__NR_linux_brk, //
|
__NR_linux_brk, //
|
||||||
__NR_linux_mmap, //
|
__NR_linux_mmap, //
|
||||||
__NR_linux_msync, //
|
__NR_linux_msync, //
|
||||||
__NR_linux_munmap, //
|
__NR_linux_munmap, //
|
||||||
__NR_linux_madvise, //
|
__NR_linux_madvise, //
|
||||||
|
__NR_linux_fadvise, //
|
||||||
__NR_linux_mprotect, //
|
__NR_linux_mprotect, //
|
||||||
__NR_linux_arch_prctl, //
|
__NR_linux_arch_prctl, //
|
||||||
__NR_linux_set_tid_address, //
|
__NR_linux_set_tid_address, //
|
||||||
|
@ -167,6 +174,7 @@ static const uint16_t kPledgeLinuxWpath[] = {
|
||||||
static const uint16_t kPledgeLinuxCpath[] = {
|
static const uint16_t kPledgeLinuxCpath[] = {
|
||||||
__NR_linux_rename, //
|
__NR_linux_rename, //
|
||||||
__NR_linux_renameat, //
|
__NR_linux_renameat, //
|
||||||
|
__NR_linux_renameat2, //
|
||||||
__NR_linux_link, //
|
__NR_linux_link, //
|
||||||
__NR_linux_linkat, //
|
__NR_linux_linkat, //
|
||||||
__NR_linux_symlink, //
|
__NR_linux_symlink, //
|
||||||
|
@ -230,6 +238,7 @@ static const uint16_t kPledgeLinuxTty[] = {
|
||||||
static const uint16_t kPledgeLinuxProc[] = {
|
static const uint16_t kPledgeLinuxProc[] = {
|
||||||
__NR_linux_fork, //
|
__NR_linux_fork, //
|
||||||
__NR_linux_vfork, //
|
__NR_linux_vfork, //
|
||||||
|
__NR_linux_clone, //
|
||||||
__NR_linux_kill, //
|
__NR_linux_kill, //
|
||||||
__NR_linux_setsid, //
|
__NR_linux_setsid, //
|
||||||
__NR_linux_setpgid, //
|
__NR_linux_setpgid, //
|
||||||
|
@ -259,7 +268,8 @@ static const uint16_t kPledgeLinuxId[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint16_t kPledgeLinuxExec[] = {
|
static const uint16_t kPledgeLinuxExec[] = {
|
||||||
__NR_linux_execve, //
|
__NR_linux_execve, //
|
||||||
|
__NR_linux_execveat, //
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct Pledges {
|
static const struct Pledges {
|
||||||
|
@ -952,8 +962,9 @@ static int sys_pledge_linux(const char *promises, const char *execpromises) {
|
||||||
* lstat, fstatat, access, faccessat, readlink, readlinkat, chmod,
|
* lstat, fstatat, access, faccessat, readlink, readlinkat, chmod,
|
||||||
* fchmod, fchmodat.
|
* fchmod, fchmodat.
|
||||||
*
|
*
|
||||||
* - "cpath" (create path ops) allows rename, renameat, link, linkat,
|
* - "cpath" (create path ops) allows rename, renameat, renameat2, link,
|
||||||
* symlink, symlinkat, unlink, rmdir, unlinkat, mkdir, mkdirat.
|
* linkat, symlink, symlinkat, unlink, rmdir, unlinkat, mkdir,
|
||||||
|
* mkdirat.
|
||||||
*
|
*
|
||||||
* - "flock" allows flock, fcntl(F_GETLK), fcntl(F_SETLK),
|
* - "flock" allows flock, fcntl(F_GETLK), fcntl(F_SETLK),
|
||||||
* fcntl(F_SETLKW).
|
* fcntl(F_SETLKW).
|
||||||
|
@ -980,10 +991,10 @@ static int sys_pledge_linux(const char *promises, const char *execpromises) {
|
||||||
* - "id" allows setuid, setreuid, setresuid, setgid, setregid,
|
* - "id" allows setuid, setreuid, setresuid, setgid, setregid,
|
||||||
* setresgid, setgroups, prlimit, setrlimit, getpriority, setpriority.
|
* setresgid, setgroups, prlimit, setrlimit, getpriority, setpriority.
|
||||||
*
|
*
|
||||||
* - "exec" allows execve. If this is used then APE binaries should be
|
* - "exec" allows execve, execveat. If this is used then APE binaries
|
||||||
* assimilated in order to work on OpenBSD. On Linux, mmap() will be
|
* should be assimilated in order to work on OpenBSD. On Linux, mmap()
|
||||||
* loosened up to allow creating PROT_EXEC memory (for APE loader) and
|
* will be loosened up to allow creating PROT_EXEC memory (for APE
|
||||||
* system call origin verification won't be activated.
|
* loader) and system call origin verification won't be activated.
|
||||||
*
|
*
|
||||||
* @return 0 on success, or -1 w/ errno
|
* @return 0 on success, or -1 w/ errno
|
||||||
* @raise ENOSYS if host os isn't Linux or OpenBSD
|
* @raise ENOSYS if host os isn't Linux or OpenBSD
|
||||||
|
|
|
@ -58,7 +58,7 @@ scall sys_writev 0x0790790792079014 globl hidden
|
||||||
scall sys_access 0x0210210212021015 globl hidden
|
scall sys_access 0x0210210212021015 globl hidden
|
||||||
scall __sys_pipe 0x02a10721e202a016 globl hidden # NOTE: pipe2() on FreeBSD; XNU is pipe(void)→eax:edx
|
scall __sys_pipe 0x02a10721e202a016 globl hidden # NOTE: pipe2() on FreeBSD; XNU is pipe(void)→eax:edx
|
||||||
scall sys_select 0x1a104705d205d017 globl hidden
|
scall sys_select 0x1a104705d205d017 globl hidden
|
||||||
scall pseletc 0x1b406e20a218afff globl
|
scall pselect 0x1b406e20a218afff globl
|
||||||
scall pselect6 0xfffffffffffff10e globl
|
scall pselect6 0xfffffffffffff10e globl
|
||||||
scall sys_sched_yield 0x15e12a14bffff018 globl hidden # swtch on xnu? possibly removed in 12.4
|
scall sys_sched_yield 0x15e12a14bffff018 globl hidden # swtch on xnu? possibly removed in 12.4
|
||||||
scall __sys_mremap 0x19bffffffffff019 globl hidden
|
scall __sys_mremap 0x19bffffffffff019 globl hidden
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned P[] = {
|
unsigned P[] = {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(bitreverse, test) {
|
TEST(bitreverse, test) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(_countbits, testLow) {
|
TEST(_countbits, testLow) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(morton, test) {
|
TEST(morton, test) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(access, efault) {
|
TEST(access, efault) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(chdir, efault) {
|
TEST(chdir, efault) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp(void) {
|
void SetUp(void) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static textstartup void TestInit(int argc, char **argv) {
|
static textstartup void TestInit(int argc, char **argv) {
|
||||||
|
|
|
@ -33,8 +33,8 @@ int ws, pid;
|
||||||
char testlib_enable_tmp_setup_teardown;
|
char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
// TODO(jart): what's up with rhel5 / rhel7?
|
pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
||||||
// pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UsingBinfmtMisc(void) {
|
bool UsingBinfmtMisc(void) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(fcntl_getfl, testRemembersAccessMode) {
|
TEST(fcntl_getfl, testRemembersAccessMode) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(fileexists, test) {
|
TEST(fileexists, test) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ const char *path;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath", 0);
|
pledge("stdio rpath wpath cpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ftruncate, test) {
|
TEST(ftruncate, test) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath cpath fattr", 0);
|
pledge("stdio rpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(getcwd, test) {
|
TEST(getcwd, test) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr proc", 0);
|
pledge("stdio rpath wpath cpath fattr proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(lseek, wat) {
|
TEST(lseek, wat) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp(void) {
|
void SetUp(void) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(open, efault) {
|
TEST(open, efault) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(dog, testReadPastEof_returnsZero) {
|
TEST(dog, testReadPastEof_returnsZero) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath tty", 0);
|
pledge("stdio rpath tty", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,6 +34,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(readlink, enoent) {
|
TEST(readlink, enoent) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(rename, enoent) {
|
TEST(rename, enoent) {
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc", 0);
|
pledge("stdio rpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's been reported that Chromebooks return EINVAL here.
|
// It's been reported that Chromebooks return EINVAL here.
|
||||||
|
|
|
@ -32,6 +32,7 @@ bool gotsig;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSigAlrm(int sig, siginfo_t *si, ucontext_t *ctx) {
|
void OnSigAlrm(int sig, siginfo_t *si, ucontext_t *ctx) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ volatile bool gotsigint;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc", 0);
|
pledge("stdio rpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSigInt(int sig) {
|
void OnSigInt(int sig) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ testonly void OnUsr1(int sig) {
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc", 0);
|
pledge("stdio rpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(signal, test) {
|
TEST(signal, test) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ volatile int n;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc", 0);
|
pledge("stdio rpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSig(int sig, siginfo_t *si, ucontext_t *ctx) {
|
void OnSig(int sig, siginfo_t *si, ucontext_t *ctx) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(stat_010, testEmptyFile_sizeIsZero) {
|
TEST(stat_010, testEmptyFile_sizeIsZero) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct stat st;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(symlink, enoent) {
|
TEST(symlink, enoent) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(unlink, efault) {
|
TEST(unlink, efault) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(utimensat, test) {
|
TEST(utimensat, test) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath fattr", 0);
|
pledge("stdio rpath wpath cpath fattr", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(writev, test) {
|
TEST(writev, test) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CompareDnsNames, testEmpty) {
|
TEST(CompareDnsNames, testEmpty) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ void SetUp(void) {
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(malloc, zeroMeansOne) {
|
TEST(malloc, zeroMeansOne) {
|
||||||
|
|
|
@ -33,8 +33,8 @@ STATIC_YOINK("apetest2.com");
|
||||||
char testlib_enable_tmp_setup_teardown_once;
|
char testlib_enable_tmp_setup_teardown_once;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
// TODO(jart): What's up with RHEL5 / RHEL7?
|
pledge("stdio rpath wpath cpath tty proc exec", 0);
|
||||||
// pledge("stdio rpath wpath cpath tty proc exec", 0);
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Extract(const char *from, const char *to, int mode) {
|
void Extract(const char *from, const char *to, int mode) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(arch_prctl, fs) {
|
TEST(arch_prctl, fs) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ _Atomic(int) thechilde;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath thread", 0);
|
pledge("stdio rpath thread", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp(void) {
|
void SetUp(void) {
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc", 0);
|
pledge("stdio rpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(fork, testPipes) {
|
TEST(fork, testPipes) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool AreMemoryIntervalsEqual(const struct MemoryIntervals *mm1,
|
static bool AreMemoryIntervalsEqual(const struct MemoryIntervals *mm1,
|
||||||
|
|
|
@ -50,6 +50,7 @@ char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath wpath cpath proc", 0);
|
pledge("stdio rpath wpath cpath proc", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(mmap, zeroSize) {
|
TEST(mmap, zeroSize) {
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath proc inet", 0);
|
pledge("stdio rpath proc inet", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dontdiscard char *FormatPollFd(struct pollfd p[2]) {
|
dontdiscard char *FormatPollFd(struct pollfd p[2]) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath", 0);
|
pledge("stdio rpath", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEST(select, allZero) {
|
// TEST(select, allZero) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath inet", 0);
|
pledge("stdio rpath inet", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(setsockopt, SO_RCVTIMEO) {
|
TEST(setsockopt, SO_RCVTIMEO) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath tty", 0);
|
pledge("stdio rpath tty", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(socketpair, testAfUnixStream) {
|
TEST(socketpair, testAfUnixStream) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void init(void) {
|
__attribute__((__constructor__)) static void init(void) {
|
||||||
pledge("stdio rpath cpath proc unix", 0);
|
pledge("stdio rpath cpath proc unix", 0);
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char testlib_enable_tmp_setup_teardown;
|
char testlib_enable_tmp_setup_teardown;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue