lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jun 2023 21:07:22 +0800
From:   Zhangjin Wu <falcon@...ylab.org>
To:     w@....eu
Cc:     thomas@...ch.de, arnd@...db.de, falcon@...ylab.org,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: [PATCH v1 11/17] selftests/nolibc: prepare tmpfs and hugetlbfs

Let's make the /tmp and /hugetlb directories and mount tmpfs and
hugetlbfs respectively, they will be used to check the existing of tmpfs
and hugetlbfs.

We will also use tmpfs to let some test cases run without procfs.

Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 69f59a395746..8b587961e46a 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -935,6 +935,18 @@ int prepare(void)
 		}
 	}
 
+	/* try to mount /tmp if not mounted. Silently fail otherwise */
+	if (stat("/tmp/.", &stat_buf) == 0 || mkdir("/tmp", 0755) == 0) {
+		if (mount("none", "/tmp", "tmpfs", 0, 0) != 0)
+			rmdir("/tmp");
+	}
+
+	/* try to mount /hugetlb if not mounted. Silently fail otherwise */
+	if (stat("/hugetlb/.", &stat_buf) == 0 || mkdir("/hugetlb", 0755) == 0) {
+		if (mount("none", "/hugetlb", "hugetlbfs", 0, 0) != 0)
+			rmdir("/hugetlb");
+	}
+
 	return 0;
 }
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ