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] [day] [month] [year] [list]
Date:	Thu, 25 Dec 2008 23:14:11 -0500
From:	Theodore Tso <tytso@....EDU>
To:	Paul Collins <paul@...ly.ondioline.org>
Cc:	linux-ext4@...r.kernel.org
Subject: Re: (resend) extent header problems following shrink with resize2fs

On Thu, Dec 25, 2008 at 08:18:48PM +1300, Paul Collins wrote:
> Theodore Tso <tytso@....EDU> writes:
> > Yeah, resize2fs needs to be fixed to handle extents correctly.  At the
> > moment it can screw them up pretty badly.
> 
> In the meantime, perhaps something like the patch below is appropriate?

Actually, I think the following patch should fix things up nicely.  I
need to create a test case so I can be sure this fixes the problem,
but I think this should address the root cause of theproblem you
reported.

						- Ted

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index abe05f5..65398a6 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1188,6 +1188,16 @@ static int process_block(ext2_filsys fs, blk_t	*block_nr,
 	return ret;
 }
 
+static int process_block_ind(ext2_filsys fs, blk_t *block_nr,
+			     e2_blkcnt_t blockcnt, blk_t ref_block, 
+			     int ref_offset, void *priv_data)
+{
+	if (blockcnt >= 0)
+		return 0;
+	return process_block(fs, block_nr, blockcnt, ref_block, ref_offset,
+			     priv_data);
+}
+
 /*
  * Progress callback
  */
@@ -1302,6 +1312,18 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
 		if (ext2fs_inode_has_valid_blocks(inode) &&
 		    (rfs->bmap || pb.is_dir)) {
 			pb.ino = ino;
+			if (inode->i_flags & EXT4_EXTENTS_FL) {
+				/*
+				 * With extent-based files, we have
+				 * to translate all of the interior
+				 * node blocks first.
+				 */
+				retval = ext2fs_block_iterate2(rfs->old_fs,
+						ino, 0, block_buf,
+						process_block_ind, &pb);
+				if (retval)
+					goto errout;
+			}
 			retval = ext2fs_block_iterate2(rfs->old_fs,
 						       ino, 0, block_buf,
 						       process_block, &pb);
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ