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]
Message-ID: <175182663077.1984706.5289392692912386059.stgit@frogsfrogsfrogs>
Date: Sun, 06 Jul 2025 11:32:18 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 6/8] fuse2fs: fix incorrect EOFS input handling in FITRIM

From: Darrick J. Wong <djwong@...nel.org>

FITRIM isn't well documented, which means that I missed that
len == -1ULL always means "trim to end of filesystem".  generic/260 has
been failing with:

--- a/tests/generic/260.out      2025-04-30 16:20:44.532797310 -0700
+++ b/tests/generic/260.out.bad        2025-07-03 11:44:26.946394170 -0700
@@ -11,4 +11,5 @@
 [+] Default length with start set (should succeed)
 [+] Length beyond the end of fs (should succeed)
 [+] Length beyond the end of fs with start set (should succeed)
+After the full fs discard 0 bytes were discarded however the file system is 10401542144 bytes long.
 Test done

because the addition used to compute end suffered an integer overflow,
resulting in end < start, which meant nothing happened.  Fix this by
explicitly checking for -1ULL.

Cc: <linux-ext4@...r.kernel.org> # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
 misc/fuse2fs.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 5b866aed98237f..34eaad1573132f 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -3775,7 +3775,10 @@ static int ioctl_fitrim(struct fuse2fs *ff, struct fuse2fs_file_handle *fh,
 		return -EROFS;
 
 	start = FUSE2FS_B_TO_FSBT(ff, fr->start);
-	end = FUSE2FS_B_TO_FSBT(ff, fr->start + fr->len - 1);
+	if (fr->len == -1ULL)
+		end = -1ULL;
+	else
+		end = FUSE2FS_B_TO_FSBT(ff, fr->start + fr->len - 1);
 	minlen = FUSE2FS_B_TO_FSBT(ff, fr->minlen);
 
 	if (EXT2FS_NUM_B2C(fs, minlen) > EXT2_CLUSTERS_PER_GROUP(fs->super) ||


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ