52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
From a01d2a9d1141380801a890c5e5cd2100ee7c93b2 Mon Sep 17 00:00:00 2001
|
|
From: Edward Liaw <edliaw@google.com>
|
|
Date: Thu, 28 Apr 2022 20:17:56 +0000
|
|
Subject: [PATCH 19/24] binderfs: skip when user namespace unavailable
|
|
|
|
Skips the unprivileged test as this depends on CONFIG_USER_NS which
|
|
we don't set for Android platforms.
|
|
|
|
Signed-off-by: Edward Liaw <edliaw@google.com>
|
|
---
|
|
.../selftests/filesystems/binderfs/binderfs_test.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
|
|
index 0315955ff0f41..543b4bca893c5 100644
|
|
--- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
|
|
+++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
|
|
@@ -290,6 +290,11 @@ static int write_id_mapping(enum idmap_type type, pid_t pid, const char *buf,
|
|
return 0;
|
|
}
|
|
|
|
+static bool has_userns()
|
|
+{
|
|
+ return (access("/proc/self/ns/user", F_OK) == 0);
|
|
+}
|
|
+
|
|
static void change_userns(struct __test_metadata *_metadata, int syncfds[2])
|
|
{
|
|
int ret;
|
|
@@ -377,6 +382,9 @@ static void *binder_version_thread(void *data)
|
|
*/
|
|
TEST(binderfs_stress)
|
|
{
|
|
+ if (!has_userns())
|
|
+ SKIP(return, "%s: user namespace not supported\n", __func__);
|
|
+
|
|
int fds[1000];
|
|
int syncfds[2];
|
|
pid_t pid;
|
|
@@ -500,6 +508,8 @@ TEST(binderfs_test_privileged)
|
|
|
|
TEST(binderfs_test_unprivileged)
|
|
{
|
|
+ if (!has_userns())
|
|
+ SKIP(return, "%s: user namespace not supported\n", __func__);
|
|
int ret;
|
|
int syncfds[2];
|
|
pid_t pid;
|
|
--
|
|
2.36.0.550.gb090851708-goog
|
|
|