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] [day] [month] [year] [list]
Message-ID: <20260113191702.GP3634291@ZenIV>
Date: Tue, 13 Jan 2026 19:17:02 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Mark Brown <broonie@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, torvalds@...ux-foundation.org,
	brauner@...nel.org, jack@...e.cz, mjguzik@...il.com,
	paul@...l-moore.com, axboe@...nel.dk, audit@...r.kernel.org,
	io-uring@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 15/59] struct filename: saner handling of long names

On Tue, Jan 13, 2026 at 07:07:01PM +0000, Al Viro wrote:

> FWIW, an unpleasant surprise is that LTP apparently doesn't test that
> case anywhere - the effect of that braino is to lower the cutoff for
> name length by 48 characters and there's not a single test in there
> that would test that ;-/
> 
> chdir04 does check that name component is not too long, but that's
> a different codepath - it's individual filesystem's ->lookup() rejecting
> a component.
> 
> Oh, well - not hard to add (to the same chdir04, for example)...

Crude variant on top of https://github.com/linux-test-project/ltp #master:

diff --git a/testcases/kernel/syscalls/chdir/chdir04.c b/testcases/kernel/syscalls/chdir/chdir04.c
index 6e53b7fef..7e959e090 100644
--- a/testcases/kernel/syscalls/chdir/chdir04.c
+++ b/testcases/kernel/syscalls/chdir/chdir04.c
@@ -11,6 +11,8 @@
 #include "tst_test.h"
 
 static char long_dir[] = "abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
+static char long_path_4096[4096+1];
+static char long_path_4094[4094+1];
 static char noexist_dir[] = "noexistdir";
 
 static struct tcase {
@@ -20,16 +22,26 @@ static struct tcase {
 	{long_dir, ENAMETOOLONG},
 	{noexist_dir, ENOENT},
 	{0, EFAULT}, // bad_addr
+	{long_path_4096, ENAMETOOLONG},
+	{long_path_4094, 0},
 };
 
 static void verify_chdir(unsigned int i)
 {
-	TST_EXP_FAIL(chdir(tcases[i].dir), tcases[i].exp_errno, "chdir()");
+	if (tcases[i].exp_errno)
+		TST_EXP_FAIL(chdir(tcases[i].dir), tcases[i].exp_errno, "chdir()");
+	else
+		TST_EXP_PASS(chdir(tcases[i].dir), "chdir()");
 }
 
 static void setup(void)
 {
 	tcases[2].dir = tst_get_bad_addr(NULL);
+	for (int i = 0; i < 4096; ) {
+		long_path_4096[i++] = '.';
+		long_path_4096[i++] = '/';
+	}
+	memcpy(long_path_4094, long_path_4096, 4094);
 }
 
 static struct tst_test test = {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ