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: <20120217143026.GA19606@thunk.org>
Date:	Fri, 17 Feb 2012 09:30:26 -0500
From:	Ted Ts'o <tytso@....edu>
To:	Lukas Czerner <lczerner@...hat.com>
Cc:	Phillip Susi <psusi@...ntu.com>, linux-ext4@...r.kernel.org
Subject: Re: [PATCH 1/2] e2image: truncate raw image file to correct size

On Fri, Feb 17, 2012 at 11:04:22AM +0100, Lukas Czerner wrote:
> > lseek(5, 1048576, SEEK_CUR)             = 16105177088
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> So if blocks count ends right here^^, then the last write would not
> happen, because sparse == 0. The reason is that we will seek when the
> sparse >= 1024*1024 and then set sparse = 0

Yes, there are two cases when sparse can get set to zero.  I was
thinking of the other one; thanks for pointing that out.

> We can easily fix that by doing this instead:
> 
> if (sparse > 1024*1024) {
> 	write_block(fd, 0, 1024*1024, 0, 0);
> 	sparse -= 1024*1024;
> }

Yep, thanks for the suggestion; I like that.  I'll chain to this
message the two patches that I've put together which I think should
address this issue.  The first uses your suggestion so sparse never
gets set to zero when we are still extending the hole.

The second uses ftruncate64() if possible to set i_size (which saves
allocating a block, which is cool when it works).

What do folks think?

	     	    	     	       	  - Ted
--
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