summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/landlock/true.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/landlock/true.c')
-rw-r--r--tools/testing/selftests/landlock/true.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/landlock/true.c b/tools/testing/selftests/landlock/true.c
index 3f9ccbf52783..1e39b664512d 100644
--- a/tools/testing/selftests/landlock/true.c
+++ b/tools/testing/selftests/landlock/true.c
@@ -1,5 +1,15 @@
// SPDX-License-Identifier: GPL-2.0
+/*
+ * Minimal helper for Landlock selftests. Opens its own working directory
+ * before exiting, which may trigger access denials depending on the sandbox
+ * configuration.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+
int main(void)
{
+ close(open(".", O_RDONLY | O_DIRECTORY | O_CLOEXEC));
return 0;
}