Add latest Linux syscalls including landlock

See #485
This commit is contained in:
Justine Tunney 2022-07-15 18:29:49 -07:00
parent 2e3958c6dc
commit 13d67fed38
25 changed files with 111 additions and 0 deletions

42
libc/calls/landlock.h Normal file
View file

@ -0,0 +1,42 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_LANDLOCK_H_
#define COSMOPOLITAN_LIBC_CALLS_LANDLOCK_H_
#define LANDLOCK_ACCESS_FS_EXECUTE 0x0001ul
#define LANDLOCK_ACCESS_FS_WRITE_FILE 0x0002ul
#define LANDLOCK_ACCESS_FS_READ_FILE 0x0004ul
#define LANDLOCK_ACCESS_FS_READ_DIR 0x0008ul
#define LANDLOCK_ACCESS_FS_REMOVE_DIR 0x0010ul
#define LANDLOCK_ACCESS_FS_REMOVE_FILE 0x0020ul
#define LANDLOCK_ACCESS_FS_MAKE_CHAR 0x0040ul
#define LANDLOCK_ACCESS_FS_MAKE_DIR 0x0080ul
#define LANDLOCK_ACCESS_FS_MAKE_REG 0x0100ul
#define LANDLOCK_ACCESS_FS_MAKE_SOCK 0x0200ul
#define LANDLOCK_ACCESS_FS_MAKE_FIFO 0x0400ul
#define LANDLOCK_ACCESS_FS_MAKE_BLOCK 0x0800ul
#define LANDLOCK_ACCESS_FS_MAKE_SYM 0x1000ul
#define LANDLOCK_ACCESS_FS_REFER 0x2000ul
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
enum landlock_rule_type {
LANDLOCK_RULE_PATH_BENEATH = 1,
};
struct landlock_ruleset_attr {
uint64_t handled_access_fs;
};
struct thatispacked landlock_path_beneath_attr {
uint64_t allowed_access;
int32_t parent_fd;
};
int landlock_restrict_self(int, uint32_t);
int landlock_add_rule(int, enum landlock_rule_type, const void *, uint32_t);
int landlock_create_ruleset(const struct landlock_ruleset_attr *, size_t,
uint32_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_LANDLOCK_H_ */

2
libc/sysv/calls/clone3.s Normal file
View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall clone3,0xfffffffffffff1b3,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall close_range,0xfffffffffffff1b4,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall epoll_pwait2,0xfffffffffffff1b9,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall faccessat2,0xfffffffffffff1b7,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall fsconfig,0xfffffffffffff1af,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall fsmount,0xfffffffffffff1b0,globl

2
libc/sysv/calls/fsopen.s Normal file
View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall fsopen,0xfffffffffffff1ae,globl

2
libc/sysv/calls/fspick.s Normal file
View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall fspick,0xfffffffffffff1b1,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall futex_waitv,0xfffffffffffff1c1,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall landlock_add_rule,0xfffffffffffff1bd,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall landlock_create_ruleset,0xfffffffffffff1bc,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall landlock_restrict_self,0xfffffffffffff1be,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall memfd_secret,0xfffffffffffff1bf,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall mount_setattr,0xfffffffffffff1ba,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall move_mount,0xfffffffffffff1ad,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall open_tree,0xfffffffffffff1ac,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall openat2,0xfffffffffffff1b5,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall pidfd_getfd,0xfffffffffffff1b6,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall pidfd_open,0xfffffffffffff1b2,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall process_madvise,0xfffffffffffff1b8,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall process_mrelease,0xfffffffffffff1c0,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall quotactl_fd,0xfffffffffffff1bb,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall set_mempolicy_home_node,0xfffffffffffff1c2,globl

View file

@ -376,6 +376,29 @@ scall io_uring_register 0xfffffffffffff1ab globl
scall sys_pledge 0xfff06cffffffffff globl # └─ online linux services ban the president of united states of america scall sys_pledge 0xfff06cffffffffff globl # └─ online linux services ban the president of united states of america
scall msyscall 0xfff025ffffffffff globl scall msyscall 0xfff025ffffffffff globl
scall sys_bogus 0x5005005002500500 globl scall sys_bogus 0x5005005002500500 globl
scall open_tree 0xfffffffffffff1ac globl
scall move_mount 0xfffffffffffff1ad globl
scall fsopen 0xfffffffffffff1ae globl
scall fsconfig 0xfffffffffffff1af globl
scall fsmount 0xfffffffffffff1b0 globl
scall fspick 0xfffffffffffff1b1 globl
scall pidfd_open 0xfffffffffffff1b2 globl
scall clone3 0xfffffffffffff1b3 globl
scall close_range 0xfffffffffffff1b4 globl
scall openat2 0xfffffffffffff1b5 globl # Linux 5.6
scall pidfd_getfd 0xfffffffffffff1b6 globl
scall faccessat2 0xfffffffffffff1b7 globl
scall process_madvise 0xfffffffffffff1b8 globl
scall epoll_pwait2 0xfffffffffffff1b9 globl
scall mount_setattr 0xfffffffffffff1ba globl
scall quotactl_fd 0xfffffffffffff1bb globl
scall landlock_create_ruleset 0xfffffffffffff1bc globl
scall landlock_add_rule 0xfffffffffffff1bd globl
scall landlock_restrict_self 0xfffffffffffff1be globl
scall memfd_secret 0xfffffffffffff1bf globl
scall process_mrelease 0xfffffffffffff1c0 globl
scall futex_waitv 0xfffffffffffff1c1 globl
scall set_mempolicy_home_node 0xfffffffffffff1c2 globl
# The Fifth Bell System Interface, Community Edition # The Fifth Bell System Interface, Community Edition
# » besiyata dishmaya # » besiyata dishmaya