From: Sami Liedes Subject: Re: Intentionally corrupted vfat fs causing BUG Date: Thu, 23 Oct 2014 23:46:04 +0300 Message-ID: <20141023204604.GB4392@sli.dy.fi> References: <87y4sk5pul.fsf@devron.myhome.or.jp> <543B8FA7.9000106@nod.at> <87r3yc5oqt.fsf@devron.myhome.or.jp> <5443E87A.2060207@nod.at> <87oat29551.fsf@devron.myhome.or.jp> <20141023160106.GB7996@ZenIV.linux.org.uk> <20141023161606.GC7996@ZenIV.linux.org.uk> <877fzq91ky.fsf@devron.myhome.or.jp> <20141023165533.GD7996@ZenIV.linux.org.uk> <20141023172158.GF7996@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NMuMz9nt05w80d4+" Cc: OGAWA Hirofumi , Richard Weinberger , linux-fsdevel To: Al Viro Return-path: Received: from gw02.mail.saunalahti.fi ([195.197.172.116]:34226 "EHLO gw02.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753073AbaJWUqN (ORCPT ); Thu, 23 Oct 2014 16:46:13 -0400 Content-Disposition: inline In-Reply-To: <20141023172158.GF7996@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 23, 2014 at 06:21:58PM +0100, Al Viro wrote: > Untested interim fix follows; as soon as d_splice_alias()/d_materialise_u= nique() > merge happens, we'll be able to clean vfat_lookup() a bit more. >=20 > a) don't bother with ->d_time for positives - we only check it for negati= ves > anyway. > b) make sure to set it at unlink and rmdir time - at *that* point soon-to= -be > negative dentry matches then-current directory contents > c) don't go into renaming of old alias in vfat_lookup() unless it has > the same parent (which it will, unless we are seeing corrupted image) *an= d* > is a non-directory > d) use (for now) d_materialise_unique() instead of d_splice_alias() - tha= t one > will do renames of old directory aliases just fine (and pretty soon so wi= ll > d_splice_alias(), but this bug is -stable fodder) >=20 > Signed-off-by: Al Viro Tested-by: Sami Liedes I can verify that this patch fixes the crash on 3.17.1. However I have not tested that it doesn't break something else like non-fuzzed filesystems :-) I'm going to rerun the fuzz tests on vfat with this patch applied. Sami --NMuMz9nt05w80d4+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJUSWkMAAoJEKLT589SE0a03z8P/RXNH1vUr1NYw1354lX8GTkQ AG09KSGoE7CgLRns1UTpyCSLvaC7yr/+sB4rDQ2xaepAhs9DZ71mbMTj91sBm2kM 2o5YyH3AzFIJBnhk7s9UREbvqQA18cLw2XQ6CiAdljWX7qpqd60Vao0h4LLEJ9Ya 9MQa7dsXGs5eSDMfPpcD1e5kQh/EQytVwNbOlYnQfPVE3oDtxxs23ByNOMhNakLx a+GyLoge/siXr7qaZz1OOqMO+BIDdmeEjVJr2yGLDP4w74ldIwI31VbWdwSwtrgh /d43l7AaMRT7jBhAsXkQB93GFGw3cwHnHo8wCwLzCybXmkYn+QDm5d21/iPzAemg cplx+iXHNoTCLQ1QqKb+nojn/nDgOaHxJlR61nG5QN6i5vv791JMXFiUNF71s45q E5E7v+MNkc744ONzn5Hf4/ZP0G71DZ+Q5fbz5ZR2Gelf72z/yNRwvRz0Ry5Qcw0Y wHfgVEFVj0y8XTuDjuMADCONAkF6vZ4N0cIMjpOA3n4CHGinoQKhOD++J0V5rvwB ZOrWvF4enPDnIsdOqGeqkP8RHrwJZV2mRp3ErPwXMNybSDHhOe+XZDIeM+yXnZAa v4cxT4l+yriKtsOtux0pTH4BupQaXIH80WtRKw8SJet+hm+faYSr/Eiov6Mdz4r1 b5h3k44m52q9G3zzIfLv =xqDk -----END PGP SIGNATURE----- --NMuMz9nt05w80d4+--