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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jun 2023 21:21:12 +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 17/17] selftests/nolibc: vfprintf: support tmpfs and hugetlbfs

When CONFIG_TMPFS not enabled, kernel will use the ramfs based tmpfs
instead, but memfd_create doesn't work with such tmpfs, for this type of
tmpfs, let's use it instead of memfd_create.

At the same time, let's support hugetlbfs too if there is one.

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

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 85fa64746cde..bff72365a158 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -796,6 +796,14 @@ static int expect_vfprintf(int llen, size_t c, const char *expected, const char
 	if (fd == -1)
 		fd = memfd_create("vfprintf", 0);
 
+	/* memfd_create not work with ramfs based tmpfs, try tmpfs and hugetlbfs in order instead */
+	if (fd == -1) {
+		if (tmpfs)
+			fd = open("/tmp/vfprintf", O_CREAT | O_TRUNC | O_RDWR);
+		else if (hugetlbfs)
+			fd = open("/hugetlb/vfprintf", O_CREAT | O_TRUNC | O_RDWR);
+	}
+
 	if (fd == -1) {
 		pad_spc(llen, 64, "[FAIL]\n");
 		return 1;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ