cosmopolitan/test/libc/calls
Justine Tunney 7cf66bc161 Prevent Make from talking to public Internet
This change introduces the nointernet() function which may be called to
prevent a process and its descendants from communicating with publicly
routable Internet addresses. GNU Make has been modified to always call
this function. In the future Landlock Make will have a way to whitelist
subnets to override this behavior, or disable it entirely. Support is
available for Linux only. Our firewall does not require root access.

Calling nointernet() will return control to the caller inside a new
process that has a SECCOMP BPF filter installed, which traps network
related system calls. Your original process then becomes a permanent
ptrace() supervisor that monitors all processes and threads descending
from the returned child. Whenever a networking system call happens the
kernel will stop the process and wakes up the monitor, which then peeks
into the child memory to read the sockaddr_in to determine if it's ok.

The downside to doing this is that there can be only one supervisor at a
time using ptrace() on a process. So this firewall won't be enabled if
you run make under strace or inside gdb. It also makes testing tricky.
2022-08-12 21:51:39 -07:00
..
_timespec_test.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
access_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
chdir_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
clock_getres_test.c Improve system calls 2022-07-08 06:42:03 -07:00
clock_gettime_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
closefrom_test.c Make improvements 2022-07-21 03:36:42 -07:00
commandv_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
dup_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
fcntl_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
fileexists_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
ftruncate_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
getcontext_test.c Add getcontext() and setcontext() 2022-06-23 06:01:44 -07:00
getcwd_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
getitimer_test.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
ioctl_siocgifconf_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
life.c Make improvements to locking 2022-06-19 01:30:12 -07:00
lseek_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
mkdir_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
mkntcmdline_test.c Perform better fixups of NT paths in execve() 2022-06-08 18:27:19 -07:00
mkntenvblock_test.c Make build hermetic without shell scripts 2022-05-25 13:55:57 -07:00
mkntpath_test.c Make fixes and improvements 2022-06-18 01:46:12 -07:00
nanosleep_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
open_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
openbsd_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
pipe_test.c Make more fixes and improvements 2022-06-13 11:02:13 -07:00
pledge2_test.c Refactor pledge() to be more configurable 2022-08-11 11:35:30 -07:00
pledge_test.c Refactor pledge() to be more configurable 2022-08-11 11:35:30 -07:00
pread_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
printargs_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
ptrace_test.c Prevent Make from talking to public Internet 2022-08-12 21:51:39 -07:00
pwrite_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
read_test.c Reduce Makefile dependencies by 4% 2022-05-23 15:07:01 -07:00
readansi_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
readlinkat_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
renameat_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
reservefd_test.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
sched_getaffinity_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
sched_setscheduler_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
seccomp_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
setitimer_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
setrlimit_test.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
sigaction_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
signal_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
sigprocmask_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
sigsuspend_test.c Reduce makefile dependencies by 10% 2022-06-08 20:01:28 -07:00
stat_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
symlinkat_test.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
sys_ptrace_test.c Prevent Make from talking to public Internet 2022-08-12 21:51:39 -07:00
test.mk Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
tiny64.elf Bump support up to FreeBSD 13 and NetBSD 9.2 2022-06-11 10:36:17 -07:00
tkill_test.c Get threads working on all platforms 2022-05-13 03:59:09 -07:00
unlinkat_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
unveil_test.c Refactor pledge() to be more configurable 2022-08-11 11:35:30 -07:00
utimensat_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
vfork_test.c Remove plenty of makefile misconfigurations 2022-07-21 09:20:59 -07:00
write_test.c Reduce Makefile dependencies by 4% 2022-05-23 15:07:01 -07:00
writev_test.c Unbloat the build 2022-08-11 00:15:29 -07:00