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-next>] [day] [month] [year] [list]
Message-ID: <20090908132601.GA17778@duck.suse.cz>
Date:	Tue, 8 Sep 2009 15:26:01 +0200
From:	Jan Kara <jack@...e.cz>
To:	linux-ext4@...r.kernel.org
Subject: fsync on ext[34] working only by an accident

  Hi,

  When looking at how ext3/4 handles fsync, I've realized I don't
understand how writing out inode on fsync can work. The problem is that
ext3/4 mostly calls ext?_mark_inode_dirty() which actually does *not* dirty
the inode. It just copies the in-memory inode content to disk buffer.
So in particular the inode looks clean to VFS and our check in
ext?_sync_file() shouldn't trigger.
  The only obvious case when we call mark_inode_dirty() is from write_end
functions when we update i_size but that's clearly not enough. Now I did
some research why things seem to be actually working. The trick is that
when allocating block, we call vfs_dq_alloc_block() which calls
mark_inode_dirty(). But that's all what's keeping our fsync / writeout
logic from breaking!
  There are even some cases when the logic actually is broken (I've tested
it and it really does not work) - for example when you create an empty
file, the inode won't get written when you fsync it.
  So what we should IMHO do is to convert all ext?_mark_inode_dirty()
calls to simple mark_inode_dirty() (or even maybe introduce and use
mark_inode_dirty_datasync() where appropriate). It will cost us some more
CPU and stack space but if we optimize ext3_dirty_inode() for the case
where handle is already started, it shouldn't be too bad.

								Honza
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
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