| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- /* SPDX-License-Identifier: GPL-2.0 */
- /*
- * Landlock scoped_domains variants
- *
- * See the hierarchy variants from ptrace_test.c
- *
- * Copyright © 2017-2020 Mickaël Salaün <mic@digikod.net>
- * Copyright © 2019-2020 ANSSI
- * Copyright © 2024 Tahera Fahimi <fahimitahera@gmail.com>
- */
- /* clang-format on */
- FIXTURE_VARIANT(scoped_domains)
- {
- bool domain_both;
- bool domain_parent;
- bool domain_child;
- };
- /*
- * No domain
- *
- * P1-. P1 -> P2 : allow
- * \ P2 -> P1 : allow
- * 'P2
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, without_domain) {
- /* clang-format on */
- .domain_both = false,
- .domain_parent = false,
- .domain_child = false,
- };
- /*
- * Child domain
- *
- * P1--. P1 -> P2 : allow
- * \ P2 -> P1 : deny
- * .'-----.
- * | P2 |
- * '------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, child_domain) {
- /* clang-format on */
- .domain_both = false,
- .domain_parent = false,
- .domain_child = true,
- };
- /*
- * Parent domain
- * .------.
- * | P1 --. P1 -> P2 : deny
- * '------' \ P2 -> P1 : allow
- * '
- * P2
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, parent_domain) {
- /* clang-format on */
- .domain_both = false,
- .domain_parent = true,
- .domain_child = false,
- };
- /*
- * Parent + child domain (siblings)
- * .------.
- * | P1 ---. P1 -> P2 : deny
- * '------' \ P2 -> P1 : deny
- * .---'--.
- * | P2 |
- * '------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, sibling_domain) {
- /* clang-format on */
- .domain_both = false,
- .domain_parent = true,
- .domain_child = true,
- };
- /*
- * Same domain (inherited)
- * .-------------.
- * | P1----. | P1 -> P2 : allow
- * | \ | P2 -> P1 : allow
- * | ' |
- * | P2 |
- * '-------------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, inherited_domain) {
- /* clang-format on */
- .domain_both = true,
- .domain_parent = false,
- .domain_child = false,
- };
- /*
- * Inherited + child domain
- * .-----------------.
- * | P1----. | P1 -> P2 : allow
- * | \ | P2 -> P1 : deny
- * | .-'----. |
- * | | P2 | |
- * | '------' |
- * '-----------------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, nested_domain) {
- /* clang-format on */
- .domain_both = true,
- .domain_parent = false,
- .domain_child = true,
- };
- /*
- * Inherited + parent domain
- * .-----------------.
- * |.------. | P1 -> P2 : deny
- * || P1 ----. | P2 -> P1 : allow
- * |'------' \ |
- * | ' |
- * | P2 |
- * '-----------------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, nested_and_parent_domain) {
- /* clang-format on */
- .domain_both = true,
- .domain_parent = true,
- .domain_child = false,
- };
- /*
- * Inherited + parent and child domain (siblings)
- * .-----------------.
- * | .------. | P1 -> P2 : deny
- * | | P1 . | P2 -> P1 : deny
- * | '------'\ |
- * | \ |
- * | .--'---. |
- * | | P2 | |
- * | '------' |
- * '-----------------'
- */
- /* clang-format off */
- FIXTURE_VARIANT_ADD(scoped_domains, forked_domains) {
- /* clang-format on */
- .domain_both = true,
- .domain_parent = true,
- .domain_child = true,
- };
|