From: Abhinav Saxena <xandfury@gmail.com>
To: "Mickaël Salaün" <mic@digikod.net>,
"Günther Noack" <gnoack@google.com>,
"Shuah Khan" <shuah@kernel.org>
Cc: linux-security-module@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Abhinav Saxena <xandfury@gmail.com>
Subject: [PATCH RFC 2/3] selftests/landlock: add cross-domain variants
Date: Sat, 19 Jul 2025 06:41:25 -0600 [thread overview]
Message-ID: <20250719-landlock_abstractions-v1-2-2c4fd61f8973@gmail.com> (raw)
In-Reply-To: <20250719-landlock_abstractions-v1-0-2c4fd61f8973@gmail.com>
Add scoped_cross_domain_variants.h providing shared test variants for
interactions between two independent Landlock domains. Current tests
only cover hierarchical (parent-child) relationships but miss the
case where unrelated processes establish peer domains.
The header defines four canonical variants:
- none_to_none: both processes unrestricted
- none_to_scoped: only accessor process scoped
- scoped_to_none: only resource process scoped
- scoped_to_scoped: both processes scoped (peer domains)
This abstraction will be shared across signal, abstract UNIX socket,
and future scope types (like memfd execution) to ensure comprehensive
cross-domain test coverage.
Signed-off-by: Abhinav Saxena <xandfury@gmail.com>
---
.../landlock/scoped_cross_domain_variants.h | 54 ++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/tools/testing/selftests/landlock/scoped_cross_domain_variants.h b/tools/testing/selftests/landlock/scoped_cross_domain_variants.h
new file mode 100644
index 000000000000..6068987a52c8
--- /dev/null
+++ b/tools/testing/selftests/landlock/scoped_cross_domain_variants.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Landlock self-tests - cross-domain scope variants
+ *
+ * Provides one FIXTURE_VARIANT and the four canonical combinations
+ * (none->none, none->scoped, scoped->none, scoped->scoped). Every test that
+ * checks interactions between two independently created domains
+ * includes this header and iterates over the variants.
+ *
+ * Variant structure: which domain each side of the interaction lives in.
+ * resource_domain - process that creates/owns the resource
+ * accessor_domain - process that uses the resource
+ *
+ * Copyright © 2025 Abhinav Saxena <xandfury@gmail.com>
+ *
+ */
+
+FIXTURE_VARIANT(cross_domain_scope)
+{
+ enum sandbox_type resource_domain;
+ enum sandbox_type accessor_domain;
+};
+
+/* Four concrete combinations */
+FIXTURE_VARIANT_ADD(cross_domain_scope, none_to_none) {
+ .resource_domain = NO_SANDBOX,
+ .accessor_domain = NO_SANDBOX,
+};
+
+FIXTURE_VARIANT_ADD(cross_domain_scope, none_to_scoped) {
+ .resource_domain = NO_SANDBOX,
+ .accessor_domain = SCOPE_SANDBOX,
+};
+
+FIXTURE_VARIANT_ADD(cross_domain_scope, scoped_to_none) {
+ .resource_domain = SCOPE_SANDBOX,
+ .accessor_domain = NO_SANDBOX,
+};
+
+FIXTURE_VARIANT_ADD(cross_domain_scope, scoped_to_scoped) {
+ .resource_domain = SCOPE_SANDBOX,
+ .accessor_domain = SCOPE_SANDBOX,
+};
+
+/*
+ * Mapping reminder:
+ * SIGNAL resource = receiver accessor = sender
+ * ABSTRACT UNIX resource = server accessor = client
+ * future scopes resource = creator accessor = user
+ *
+ * Only the accessor domain is enforced; tests therefore expect:
+ * accessor NO_SANDBOX -> ALLOW operation
+ * accessor SCOPE_SANDBOX -> DENY if resource is outside its domain
+ */
--
2.43.0
next prev parent reply other threads:[~2025-07-19 12:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 12:41 [PATCH RFC 0/3] selftests/landlock: scoping abstractions Abhinav Saxena
2025-07-19 12:41 ` [PATCH RFC 1/3] selftests/landlock: move sandbox_type to common Abhinav Saxena
2025-07-19 12:41 ` Abhinav Saxena [this message]
2025-07-19 12:41 ` [PATCH RFC 3/3] selftests/landlock: add cross-domain signal tests Abhinav Saxena
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250719-landlock_abstractions-v1-2-2c4fd61f8973@gmail.com \
--to=xandfury@gmail.com \
--cc=gnoack@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).