From: Clemens Fruhwirth Subject: Bug#403426: kernel corrupts LUKS partition header on arm Date: Fri, 29 Dec 2006 11:52:31 +0100 Message-ID: <87lkkrgej4.wl%clemens@endorphin.org> References: <20061217022906.2434.60658.reportbug@LKG8A754B.example.org> <20061220161529.GA10820@deprecation.cyrius.com> Reply-To: Clemens Fruhwirth , 403426@bugs.debian.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Resent-To: debian-bugs-dist@lists.debian.org Resent-Message-ID: In-Reply-To: <20061220161529.GA10820@deprecation.cyrius.com> List-Post: List-Help: List-Subscribe: List-Unsubscribe: To: Martin Michlmayr Cc: dm-devel@redhat.com, Brian Brunswick , 403426@bugs.debian.org List-Id: dm-devel.ids At Wed, 20 Dec 2006 17:15:29 +0100, Martin Michlmayr wrote: > We're seeing corruption of LUKS partition headers on ARM. I've > confirmed this on two different ARM platforms (IXP4xx and IOP32x) and > with 2.6.17 and 2.6.18. > > Basically, when you create a LUKS partition on a PC and then connect > it to an ARM box and open it, you get an "automatic header conversion > from 0.99 to 0.991 triggered" message and afterwards the LUKS > partition header is corrupted. Please try the version from subversion http://luks.endorphin.org/svn/cryptsetup I just kicked this conversion routine as it is for pre-1.0 releases and guess there is no single deployment that will ever need it. This won't change the bug itself, but it won't corrupt your partition anymore. It just fails. > > Its done something like overwrite the second sector of the header with > > the first one. I had a look at the cryptsetup code, and the conversion > > message is triggered by it finding the wrong state code for the > > passphrase slot - so the data has been overwritten by the time its got > > there. That looks right. A good amount of staring out of the window, drew my attention to (read|write|write_lseek)_blockwise in util.c. Reading from a file description opened with O_DIRECT requires blockwise reading into an aligned memory segments. That's the reason for all the magic in these routines. Looking at read_blockwise, r=read(fd,buf,size) might just return a short read, that is r