cosmopolitan/test/libc/fmt
Justine Tunney 98254a7c1f Make pledge() and unveil() work amazingly
This change reconciles our pledge() implementation with the OpenBSD
kernel source code. We now a polyfill that's much closer to OpenBSD's
behavior. For example, it was discovered that "stdio" permits threads.
There were a bunch of Linux system calls that needed to be added, like
sched_yield(). The exec / execnative category division is now dropped.
We're instead using OpenBSD's "prot_exec" promise for launching APE
binaries and dynamic shared objects. We also now filter clone() flags.

The pledge.com command has been greatly improved. It now does unveiling
by default when Landlock is available. It's now smart enough to unveil a
superset of paths that OpenBSD automatically unveils with pledge(), such
as /etc/localtime. pledge.com also now checks if the executable being
launched is a dynamic shared object, in which case it unveils libraries.

These changes now make it possible to pledge curl on ubuntu 20.04 glibc:

    pledge.com -p 'stdio rpath prot_exec inet dns tty sendfd recvfd' \
        curl -s https://justine.lol/hello.txt

Here's what pledging curl on Alpine 3.16 with Musl Libc looks like:

    pledge.com -p 'stdio rpath prot_exec dns inet' \
        curl -s https://justine.lol/hello.txt

Here's what pledging curl.com w/ ape loader looks like:

    pledge.com -p 'stdio rpath prot_exec dns inet' \
        o//examples/curl.com https://justine.lol/hello.txt

The most secure sandbox, is curl.com converted to static ELF:

    o//tool/build/assimilate.com o//examples/curl.com
    pledge.com -p 'stdio rpath dns inet' \
        o//examples/curl.com https://justine.lol/hello.txt

A weird corner case needed to be handled when resolving symbolic links
during the unveiling process, that's arguably a Landlock bug. It's not
surprising since Musl and Glibc are also inconsistent here too.
2022-07-19 21:33:49 -07:00
..
atoi_test.c Make improvements 2022-04-24 10:06:05 -07:00
basename_test.c Make more fixes and improvements 2022-06-13 11:02:13 -07:00
dirname_test.c Fix basename() and dirname() 2022-04-06 00:13:44 -07:00
encodenf32_test.c Update experiment with tty audio 2022-07-15 23:07:32 -07:00
fcvt_test.c Improve memory safety 2021-10-13 17:27:13 -07:00
fmt_test.c Write tests and fixes for utimensat() 2022-06-17 02:43:00 -07:00
formatbinary64_test.c Polish redbean serialization 2022-04-29 06:10:10 -07:00
formatflex64_test.c Polish redbean serialization 2022-04-29 06:10:10 -07:00
formathex64_test.c Polish redbean serialization 2022-04-29 06:10:10 -07:00
formatint64_test.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
formatint64thousands_test.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
formatoctal32_test.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
formatoctal64_test.c Polish redbean serialization 2022-04-29 06:10:10 -07:00
itoa64radix16_test.c Change license 2020-12-27 17:18:44 -08:00
joinpaths_test.c Make pledge() and unveil() work amazingly 2022-07-19 21:33:49 -07:00
lengthuint64_test.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
palandprintf_test.c Add long double printf formatting support 2022-06-14 02:18:03 -07:00
sizetol_test.c Add cpu / mem / fsz limits to build system 2021-08-13 23:40:53 -07:00
sleb128_test.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
sprintf_s.inc Further refine printf long double change (#66) 2021-02-27 13:30:17 -08:00
sprintf_s_test.c Remove garbage collector macro from header (#114) 2021-03-07 20:23:29 -08:00
sscanf_test.c Scan fixed-width integers in vcscanf (#424) 2022-06-26 21:27:07 -07:00
strerror_r_test.c Add maxmind demo to redbean-demo.com 2022-03-18 15:31:54 -07:00
stripexts_test.c Experiment with making Python go faster 2021-08-18 21:57:11 -07:00
test.mk Make build hermetic without shell scripts 2022-05-25 13:55:57 -07:00
timevaltofiletime_test.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
uleb64_test.c Add Compress() and Uncompress() to redbean 2022-05-16 16:49:20 -07:00
uleb128_test.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
zleb64_test.c Make more fixes and improvements 2022-06-13 11:02:13 -07:00