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: <20260117034747.GA19954@macsyma.local>
Date: Fri, 16 Jan 2026 17:47:47 -1000
From: "Theodore Tso" <tytso@....edu>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: Daniel Tang <danielzgtg.opensource@...il.com>, linux-ext4@...r.kernel.org
Subject: Re: [GIT PULL] e4defrag inline data segfault fix

On Fri, Jan 16, 2026 at 06:35:59PM -0800, Darrick J. Wong wrote:
> > -	/* Has no blocks */
> > -	if (buf->st_blocks == 0) {
> > +	/* Has 0 or 1 blocks, no point to defragment */
> > +	if (buf->st_blocks <= buf->st_blksize / 512) {
> 
> ...because can't you call FS_IOC_GETFLAGS and look for
> EXT4_INLINE_DATA_FL?

I could have checked for EXT4_INLINE_DATA_FL, but we need to call
stat(2) to check for the st_blocks == 0 case, and while it is harmless
to defrag a file with a single data block, it's also pointless and a
waste of system calls.  So it's best that we skip defragging the file
in these cases:

  A) A zero-length file with st_blocks == 0
  B) A file with a single data block (st_blocks == st_blksize / 512)
  C) A file with inline data (st_blocks == 1)

... and we can do that only by checking the values returned by
stat(2).

Yes, (B) and (C) relies on Linux's behavior, since Posix is silent on
the semantics of st_blocks, but e4defrag works only by using a
Linux-specific ioctl, and using FS_IOC_GETFLAGS would also be
Linux-only.

    	       	       	       		- Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ