mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
5655c9a4e7
* Add `anet` pledge for `inet` without connect This is useful for configurations where it's desirable to start redbean under these restrictions, but not to allow `connect` socket calls. * Update message on protected/unpledged syscalls for clarity * Update redbean to add reporting for unpledged sigaction Previously it would abort without indicating what signal it failed to install when sigaction is not pledged (although it fails all of them). * Move GetHostIps before processing command line options This allows using unix.pledge as part of the options without affecting retrieving host IP addresses (which requires `connect`). It may still fail under external `pledge` command as expected; in this case IPs would need to be passed manually. * Update tests for pledge anet promise
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
#ifndef COSMOPOLITAN_LIBC_INTRIN_PROMISES_H_
|
|
#define COSMOPOLITAN_LIBC_INTRIN_PROMISES_H_
|
|
|
|
#define PROMISE_STDIO 0
|
|
#define PROMISE_RPATH 1
|
|
#define PROMISE_WPATH 2
|
|
#define PROMISE_CPATH 3
|
|
#define PROMISE_DPATH 4
|
|
#define PROMISE_FLOCK 5
|
|
#define PROMISE_FATTR 6
|
|
#define PROMISE_INET 7
|
|
#define PROMISE_UNIX 8
|
|
#define PROMISE_DNS 9
|
|
#define PROMISE_TTY 10
|
|
#define PROMISE_RECVFD 11
|
|
#define PROMISE_PROC 12
|
|
#define PROMISE_EXEC 13
|
|
#define PROMISE_ID 14
|
|
#define PROMISE_UNVEIL 15
|
|
#define PROMISE_SENDFD 16
|
|
#define PROMISE_SETTIME 17
|
|
#define PROMISE_PROT_EXEC 18
|
|
#define PROMISE_VMINFO 19
|
|
#define PROMISE_TMPPATH 20
|
|
#define PROMISE_CHOWN 21
|
|
#define PROMISE_ANET 22
|
|
#define PROMISE_LEN_ 23
|
|
|
|
#define PLEDGED(x) ((~__promises >> PROMISE_##x) & 1)
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
extern unsigned long __promises;
|
|
extern unsigned long __execpromises;
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_INTRIN_PROMISES_H_ */
|