From: Sami Liedes Subject: Re: Deadlock in VFS on corrupted filesystem Date: Sun, 13 May 2012 18:05:57 +0300 Message-ID: <20120513150557.GG7387@sli.dy.fi> References: <20120510080119.GA1969@quack.suse.cz> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HB4mHL4PVvkpZAgW" Cc: Al Viro , linux-fsdevel@vger.kernel.org To: Jan Kara Return-path: Received: from smtp-4.hut.fi ([130.233.228.94]:55931 "EHLO smtp-4.hut.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751618Ab2EMPGL (ORCPT ); Sun, 13 May 2012 11:06:11 -0400 Content-Disposition: inline In-Reply-To: <20120510080119.GA1969@quack.suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --HB4mHL4PVvkpZAgW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 10, 2012 at 10:01:19AM +0200, Jan Kara wrote: > Generally, when the directory structure is corrupted so that cycles are > created, our locking protocol is prone to deadlocks. This is somewhat > unpleasant if you have a system where you allow mounting untrusted media. > So my question is: Do we care? And if yes, how to best fix this? My naive > idea would be that we could check in d_instantiate() whether we are > creating a directory dentry and if yes, check that inode is not already > attached to a directory hierarchy (i.e. effectively forbid directory > hardlinks). But this might be a bit tricky given dentry aliases. So what > are your thoughts? Besides being a potential security problem, two other possible considerations come to my mind. Not saying that either of these need necessarily be big concern, just my thoughts: * I think it could be sensibly argued that a filesystem implementation where the flipping of a single bit in a filesystem image can cause a deadlock is not very robust, i.e. this could plausibly happen without any malice; * From testing perspective, and especially fuzz testing perspective, the tolerated presence of such flaws makes finding other, unrelated problems harder. Sami --HB4mHL4PVvkpZAgW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCgAGBQJPr83VAAoJEKLT589SE0a08JgP/0o3Uy7GHpkMlkfbL2W5dv+P ad9/gFwleXKJrYnn5TPLVOplrjCTHIGD4CgiSiFfuBD6j+KiMBD1Dno3SYe9czfu SoflZyvUmP916vY2mzOIes+ruYuWxSdFf3qriqlnX/svXooxGErQRZnehuEa1d6m dOEweokle8qEAaZZNwuE75ihBd5tAK0zhgnUREyGkGcJk/4nTFi/rSvStOwotnjA BMr+c7Wx9jJMWmr5wIkt+Rr628TWznCfCLItjuQynuEaayHBr4s1ZMgFkmJ2Eoba ytX7zGBUk/vFPGc1Fn0oixkKZ/luyv2G2gd67EqUxaCZGACvZ6Yna6STS+hE76zb eV6iYIqm0ekYPCrYFverjOBns0tOEMmFD0OCYiIRmgvBF4cr6eMOKJegR66rJHfd 2PCNIRcvJ6lSvwo0/gMfyuby9z7+2lAeb0zJ5zIO3Ljhlqq9g1AFmP2WtYoPjyry S/lGi5FUSLdItJvY8d+2UVSYtwGm6zJrulVe8uX8KlyuC2ahjBL8p6AOH3/W0IlH +jpYz6nRgTqHsFVWSDaAFyNS9/3v6DeQsltFdVmVZtWiAAWrWBnHd79wO7HXcE1E Cohx4yBLiOqlJjmJx5NZyCCYWbA8rrZbgDz1vs+MHAgwhCSLWEUknDDL3W+svuaC ESpCHY3YFAoak5Y6z7da =t/qE -----END PGP SIGNATURE----- --HB4mHL4PVvkpZAgW--