tools/testing/selftests/landlock/scoped_multiple_domain_variants.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/landlock/scoped_multiple_domain_variants.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/landlock/scoped_multiple_domain_variants.h
Extension
.h
Size
3657 bytes
Lines
153
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

enum sandbox_type {
	NO_SANDBOX,
	SCOPE_SANDBOX,
	/* Any other type of sandboxing domain */
	OTHER_SANDBOX,
};

/* clang-format on */
FIXTURE_VARIANT(scoped_vs_unscoped)
{
	const int domain_all;
	const int domain_parent;
	const int domain_children;
	const int domain_child;
	const int domain_grand_child;
};

/*
 * .-----------------.
 * |         ####### |  P3 -> P2 : allow
 * |   P1----# P2  # |  P3 -> P1 : deny
 * |         #  |  # |
 * |         # P3  # |
 * |         ####### |
 * '-----------------'
 */
/* clang-format off */
FIXTURE_VARIANT_ADD(scoped_vs_unscoped, deny_scoped) {
	.domain_all = OTHER_SANDBOX,
	.domain_parent = NO_SANDBOX,
	.domain_children = SCOPE_SANDBOX,
	.domain_child = NO_SANDBOX,
	.domain_grand_child = NO_SANDBOX,
	/* clang-format on */
};

/*
 * ###################
 * #         ####### #  P3 -> P2 : allow
 * #   P1----# P2  # #  P3 -> P1 : deny
 * #         #  |  # #
 * #         # P3  # #
 * #         ####### #
 * ###################
 */
/* clang-format off */
FIXTURE_VARIANT_ADD(scoped_vs_unscoped, all_scoped) {
	.domain_all = SCOPE_SANDBOX,
	.domain_parent = NO_SANDBOX,
	.domain_children = SCOPE_SANDBOX,
	.domain_child = NO_SANDBOX,
	.domain_grand_child = NO_SANDBOX,
	/* clang-format on */
};

/*
 * .-----------------.
 * |         .-----. |  P3 -> P2 : allow
 * |   P1----| P2  | |  P3 -> P1 : allow
 * |         |     | |
 * |         | P3  | |
 * |         '-----' |
 * '-----------------'
 */
/* clang-format off */
FIXTURE_VARIANT_ADD(scoped_vs_unscoped, allow_with_other_domain) {
	.domain_all = OTHER_SANDBOX,
	.domain_parent = NO_SANDBOX,
	.domain_children = OTHER_SANDBOX,
	.domain_child = NO_SANDBOX,
	.domain_grand_child = NO_SANDBOX,
	/* clang-format on */
};

/*
 *  .----.    ######   P3 -> P2 : allow
 *  | P1 |----# P2 #   P3 -> P1 : allow
 *  '----'    ######
 *              |
 *              P3
 */
/* clang-format off */
FIXTURE_VARIANT_ADD(scoped_vs_unscoped, allow_with_one_domain) {
	.domain_all = NO_SANDBOX,
	.domain_parent = OTHER_SANDBOX,
	.domain_children = NO_SANDBOX,
	.domain_child = SCOPE_SANDBOX,
	.domain_grand_child = NO_SANDBOX,
	/* clang-format on */
};

Annotation

Implementation Notes