/linux-5.19.10/tools/testing/selftests/landlock/ |
D | fs_test.c | 319 int ruleset_fd; in TEST_F_FORK() local 325 ruleset_fd = open(dir_s1d1, O_PATH | O_DIRECTORY | O_CLOEXEC); in TEST_F_FORK() 326 ASSERT_LE(0, ruleset_fd); in TEST_F_FORK() 327 ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in TEST_F_FORK() 331 ASSERT_EQ(0, close(ruleset_fd)); in TEST_F_FORK() 333 ruleset_fd = open(dir_s1d1, O_DIRECTORY | O_CLOEXEC); in TEST_F_FORK() 334 ASSERT_LE(0, ruleset_fd); in TEST_F_FORK() 335 ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in TEST_F_FORK() 339 ASSERT_EQ(0, close(ruleset_fd)); in TEST_F_FORK() 342 ruleset_fd = in TEST_F_FORK() [all …]
|
D | base_test.c | 105 int ruleset_fd; in TEST() local 137 ruleset_fd = in TEST() 139 ASSERT_LE(0, ruleset_fd); in TEST() 140 ASSERT_EQ(0, close(ruleset_fd)); in TEST() 153 const int ruleset_fd = in TEST() local 156 ASSERT_LE(0, ruleset_fd); in TEST() 167 ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, 0, NULL, 0)); in TEST() 171 ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in TEST() 176 ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in TEST() 184 ASSERT_EQ(0, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in TEST() [all …]
|
D | ptrace_test.c | 24 int ruleset_fd; in create_domain() local 29 ruleset_fd = in create_domain() 31 EXPECT_LE(0, ruleset_fd) in create_domain() 36 EXPECT_EQ(0, landlock_restrict_self(ruleset_fd, 0)); in create_domain() 37 EXPECT_EQ(0, close(ruleset_fd)); in create_domain()
|
D | common.h | 87 static inline int landlock_add_rule(const int ruleset_fd, in landlock_add_rule() argument 92 return syscall(__NR_landlock_add_rule, ruleset_fd, rule_type, rule_attr, in landlock_add_rule() 98 static inline int landlock_restrict_self(const int ruleset_fd, in landlock_restrict_self() argument 101 return syscall(__NR_landlock_restrict_self, ruleset_fd, flags); in landlock_restrict_self()
|
/linux-5.19.10/samples/landlock/ |
D | sandboxer.c | 34 static inline int landlock_add_rule(const int ruleset_fd, in landlock_add_rule() argument 39 return syscall(__NR_landlock_add_rule, ruleset_fd, rule_type, rule_attr, in landlock_add_rule() 45 static inline int landlock_restrict_self(const int ruleset_fd, in landlock_restrict_self() argument 48 return syscall(__NR_landlock_restrict_self, ruleset_fd, flags); in landlock_restrict_self() 83 static int populate_ruleset(const char *const env_var, const int ruleset_fd, in populate_ruleset() argument 127 if (landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, in populate_ruleset() 174 int ruleset_fd, abi; in main() local 235 ruleset_fd = in main() 237 if (ruleset_fd < 0) { in main() 241 if (populate_ruleset(ENV_FS_RO_NAME, ruleset_fd, access_fs_ro)) { in main() [all …]
|
/linux-5.19.10/security/landlock/ |
D | syscalls.c | 163 int err, ruleset_fd; in SYSCALL_DEFINE3() local 197 ruleset_fd = anon_inode_getfd("[landlock-ruleset]", &ruleset_fops, in SYSCALL_DEFINE3() 199 if (ruleset_fd < 0) in SYSCALL_DEFINE3() 201 return ruleset_fd; in SYSCALL_DEFINE3() 305 SYSCALL_DEFINE4(landlock_add_rule, const int, ruleset_fd, in SYSCALL_DEFINE4() argument 322 ruleset = get_ruleset_from_fd(ruleset_fd, FMODE_CAN_WRITE); in SYSCALL_DEFINE4() 397 SYSCALL_DEFINE2(landlock_restrict_self, const int, ruleset_fd, const __u32, in SYSCALL_DEFINE2() argument 421 ruleset = get_ruleset_from_fd(ruleset_fd, FMODE_CAN_READ); in SYSCALL_DEFINE2()
|
/linux-5.19.10/Documentation/userspace-api/ |
D | landlock.rst | 88 int ruleset_fd; 90 ruleset_fd = landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0); 91 if (ruleset_fd < 0) { 116 close(ruleset_fd); 119 err = landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, 124 close(ruleset_fd); 142 close(ruleset_fd); 150 if (landlock_restrict_self(ruleset_fd, 0)) { 152 close(ruleset_fd); 155 close(ruleset_fd);
|
/linux-5.19.10/include/linux/ |
D | syscalls.h | 1052 asmlinkage long sys_landlock_add_rule(int ruleset_fd, enum landlock_rule_type rule_type, 1054 asmlinkage long sys_landlock_restrict_self(int ruleset_fd, __u32 flags);
|