landlock_add_rule(2) System Calls Manual landlock_add_rule(2) landlock_add_rule - Landlock (libc -lc) #include /* LANDLOCK_* */ #include /* SYS_* */ int syscall(SYS_landlock_add_rule, int ruleset_fd, enum landlock_rule_type rule_type, const void *rule_attr, uint32_t flags); Landlock . " " (ruleset) (thread) . landlock_add_rule() Landlock . landlock(7) . ruleset_fd Landlock landlock_create_ruleset(2). rule_type rule_attr. rule_type : LANDLOCK_RULE_PATH_BENEATH . rule_attr : struct landlock_path_beneath_attr { __u64 allowed_access; __s32 parent_fd; } __attribute__((packed)); allowed_access parent_fd ( landlock(7)). parent_fd O_PATH . LANDLOCK_RULE_NET_PORT TCP . rule_attr : struct landlock_net_port_attr { __u64 allowed_access; __u64 port; }; allowed_access . port . 0 bind(2) . sysctl /proc/sys/net/ipv4/ip_local_port_range ( IPv6). Landlock 0 LANDLOCK_ACCESS_NET_BIND_TCP 0 . flags . landlock_add_rule() 0. -1 errno . landlock_add_rule() : EAFNOSUPPORT rule_type LANDLOCK_RULE_NET_PORT TCP . EBADF ruleset_fd rule_attr . EBADFD ruleset_fd rule_attr . EFAULT rule_attr . EINVAL flags 0. EINVAL ( rule_attr->allowed_access ). EINVAL struct landlock_path_beneath_attr ( rule_attr->allowed_access rule_attr->parent_fd ). EINVAL struct landlock_net_port_attr 65535. ENOMSG ( rule_attr->allowed_access 0). EOPNOTSUPP Landlock . EPERM ruleset_fd . . 5.13. landlock(7). landlock_create_ruleset(2), landlock_restrict_self(2), landlock(7) 3 . . : . 6.18 6 2026 landlock_add_rule(2)