1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Landlock scoped_domains variants
5 * See the hierarchy variants from ptrace_test.c
7 * Copyright © 2017-2020 Mickaël Salaün <mic@digikod.net>
8 * Copyright © 2019-2020 ANSSI
9 * Copyright © 2024 Tahera Fahimi <fahimitahera@gmail.com>
13 FIXTURE_VARIANT(scoped_domains
)
23 * P1-. P1 -> P2 : allow
27 /* clang-format off */
28 FIXTURE_VARIANT_ADD(scoped_domains
, without_domain
) {
31 .domain_parent
= false,
32 .domain_child
= false,
38 * P1--. P1 -> P2 : allow
44 /* clang-format off */
45 FIXTURE_VARIANT_ADD(scoped_domains
, child_domain
) {
48 .domain_parent
= false,
55 * | P1 --. P1 -> P2 : deny
56 * '------' \ P2 -> P1 : allow
60 /* clang-format off */
61 FIXTURE_VARIANT_ADD(scoped_domains
, parent_domain
) {
64 .domain_parent
= true,
65 .domain_child
= false,
69 * Parent + child domain (siblings)
71 * | P1 ---. P1 -> P2 : deny
72 * '------' \ P2 -> P1 : deny
77 /* clang-format off */
78 FIXTURE_VARIANT_ADD(scoped_domains
, sibling_domain
) {
81 .domain_parent
= true,
86 * Same domain (inherited)
88 * | P1----. | P1 -> P2 : allow
89 * | \ | P2 -> P1 : allow
94 /* clang-format off */
95 FIXTURE_VARIANT_ADD(scoped_domains
, inherited_domain
) {
98 .domain_parent
= false,
99 .domain_child
= false,
103 * Inherited + child domain
104 * .-----------------.
105 * | P1----. | P1 -> P2 : allow
106 * | \ | P2 -> P1 : deny
110 * '-----------------'
112 /* clang-format off */
113 FIXTURE_VARIANT_ADD(scoped_domains
, nested_domain
) {
114 /* clang-format on */
116 .domain_parent
= false,
117 .domain_child
= true,
121 * Inherited + parent domain
122 * .-----------------.
123 * |.------. | P1 -> P2 : deny
124 * || P1 ----. | P2 -> P1 : allow
128 * '-----------------'
130 /* clang-format off */
131 FIXTURE_VARIANT_ADD(scoped_domains
, nested_and_parent_domain
) {
132 /* clang-format on */
134 .domain_parent
= true,
135 .domain_child
= false,
139 * Inherited + parent and child domain (siblings)
140 * .-----------------.
141 * | .------. | P1 -> P2 : deny
142 * | | P1 . | P2 -> P1 : deny
148 * '-----------------'
150 /* clang-format off */
151 FIXTURE_VARIANT_ADD(scoped_domains
, forked_domains
) {
152 /* clang-format on */
154 .domain_parent
= true,
155 .domain_child
= true,