* [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs
@ 2026-09-10 3:10 Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:47 ` Konstantin Khorenko
0 siblings, 2 replies; 3+ messages in thread
From: Eva Kurchatova @ 2026-09-10 3:10 UTC (permalink / raw)
To: khorenko; +Cc: devel
binderfs_stress mounts binderfs and asserts on the first mount, so on
a kernel without CONFIG_ANDROID_BINDERFS the case fails rather than
reporting that the filesystem is not there.
Ask /proc/filesystems whether the kernel has it, the way
supports_filesystem() in the landlock tests and check_resctrlfs_support()
in the resctrl ones already do, and skip when it does not.
Probing with a mount instead would not work here: the test is meant to
run unprivileged, and path_mount() rejects an unprivileged caller in
may_mount() before do_new_mount() ever looks the filesystem type up, so
the probe would see EPERM whether binderfs is there or not. The child
would then still reach the real mount inside its userns and fail.
https://virtuozzo.atlassian.net/browse/VSTOR-142449
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../filesystems/binderfs/binderfs_test.c | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
index 319567f0fae1..fd1f9b6e5d46 100644
--- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
+++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
@@ -36,6 +36,28 @@
fd = -EBADF; \
}
+static bool binderfs_supported(void)
+{
+ char line[128];
+ bool ret = false;
+ FILE *f;
+
+ f = fopen("/proc/filesystems", "r");
+ if (!f)
+ return true; /* Cannot tell, let the test run and report. */
+
+ while (fgets(line, sizeof(line), f)) {
+ /* binderfs has no backing device, hence the "nodev" prefix. */
+ if (!strcmp(line, "nodev\tbinder\n")) {
+ ret = true;
+ break;
+ }
+ }
+
+ fclose(f);
+ return ret;
+}
+
static void change_mountns(struct __test_metadata *_metadata)
{
int ret;
@@ -388,6 +410,9 @@ TEST(binderfs_stress)
char binderfs_mntpt[] = P_tmpdir "/binderfs_XXXXXX",
device_path[sizeof(P_tmpdir "/binderfs_XXXXXX/") + BINDERFS_MAX_NAME];
+ if (!binderfs_supported())
+ SKIP(return, "The Android binderfs filesystem is not available");
+
ret = socketpair(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0, syncfds);
ASSERT_EQ(ret, 0) {
TH_LOG("%s - Failed to create socket pair", strerror(errno));
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs
2026-09-10 3:10 [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs Eva Kurchatova
@ 2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:47 ` Konstantin Khorenko
1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:03 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
changelog?
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 9/10/26 05:10, Eva Kurchatova wrote:
> binderfs_stress mounts binderfs and asserts on the first mount, so on
> a kernel without CONFIG_ANDROID_BINDERFS the case fails rather than
> reporting that the filesystem is not there.
>
> Ask /proc/filesystems whether the kernel has it, the way
> supports_filesystem() in the landlock tests and check_resctrlfs_support()
> in the resctrl ones already do, and skip when it does not.
>
> Probing with a mount instead would not work here: the test is meant to
> run unprivileged, and path_mount() rejects an unprivileged caller in
> may_mount() before do_new_mount() ever looks the filesystem type up, so
> the probe would see EPERM whether binderfs is there or not. The child
> would then still reach the real mount inside its userns and fail.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-142449
> Feature: fix selftests
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> ---
> .../filesystems/binderfs/binderfs_test.c | 25 +++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
> index 319567f0fae1..fd1f9b6e5d46 100644
> --- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
> +++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
> @@ -36,6 +36,28 @@
> fd = -EBADF; \
> }
>
> +static bool binderfs_supported(void)
> +{
> + char line[128];
> + bool ret = false;
> + FILE *f;
> +
> + f = fopen("/proc/filesystems", "r");
> + if (!f)
> + return true; /* Cannot tell, let the test run and report. */
> +
> + while (fgets(line, sizeof(line), f)) {
> + /* binderfs has no backing device, hence the "nodev" prefix. */
> + if (!strcmp(line, "nodev\tbinder\n")) {
> + ret = true;
> + break;
> + }
> + }
> +
> + fclose(f);
> + return ret;
> +}
> +
> static void change_mountns(struct __test_metadata *_metadata)
> {
> int ret;
> @@ -388,6 +410,9 @@ TEST(binderfs_stress)
> char binderfs_mntpt[] = P_tmpdir "/binderfs_XXXXXX",
> device_path[sizeof(P_tmpdir "/binderfs_XXXXXX/") + BINDERFS_MAX_NAME];
>
> + if (!binderfs_supported())
> + SKIP(return, "The Android binderfs filesystem is not available");
> +
> ret = socketpair(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0, syncfds);
> ASSERT_EQ(ret, 0) {
> TH_LOG("%s - Failed to create socket pair", strerror(errno));
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs
2026-09-10 3:10 [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
@ 2026-09-23 18:47 ` Konstantin Khorenko
1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:47 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
On Thu, 10 Sep 2026 06:10:01 +0300, Eva Kurchatova wrote:
> selftests: binderfs: skip the stress test without binderfs
Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.3.vz10, thanks!
[1/1] selftests: binderfs: skip the stress test without binderfs
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/f8a7964ad034
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-23 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 3:10 [Devel] [PATCH vz10 v2] selftests: binderfs: skip the stress test without binderfs Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:47 ` Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox