1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Landlock scope test helpers 4 * 5 * Copyright © 2024 Tahera Fahimi <fahimitahera@gmail.com> 6 */ 7 8 #define _GNU_SOURCE 9 10 #include <sys/types.h> 11 12 static void create_scoped_domain(struct __test_metadata *const _metadata, 13 const __u16 scope) 14 { 15 int ruleset_fd; 16 const struct landlock_ruleset_attr ruleset_attr = { 17 .scoped = scope, 18 }; 19 20 ruleset_fd = 21 landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0); 22 ASSERT_LE(0, ruleset_fd) 23 { 24 TH_LOG("Failed to create a ruleset: %s", strerror(errno)); 25 } 26 enforce_ruleset(_metadata, ruleset_fd); 27 EXPECT_EQ(0, close(ruleset_fd)); 28 } 29
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.