From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KYfSa-0000e1-Sy for mharc-grub-devel@gnu.org; Thu, 28 Aug 2008 07:14:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KYfSX-0000Ze-Ld for grub-devel@gnu.org; Thu, 28 Aug 2008 07:14:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KYfSS-0000SA-61 for grub-devel@gnu.org; Thu, 28 Aug 2008 07:14:36 -0400 Received: from [199.232.76.173] (port=45284 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KYfSR-0000Ry-Ui for grub-devel@gnu.org; Thu, 28 Aug 2008 07:14:32 -0400 Received: from mail.newtec.eu ([62.58.98.194]:1369) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KYfSR-00044Q-HM for grub-devel@gnu.org; Thu, 28 Aug 2008 07:14:31 -0400 Received: from (newtec5 [192.168.1.209]) by scmgateway.newtec.be with smtp id 52f4_7c5006fa_74f2_11dd_b118_00188b32e08b; Thu, 28 Aug 2008 13:14:30 +0200 Received: from betur.newtec.eu ([192.168.210.209]) by mail.newtec.eu with ESMTP; Thu, 28 Aug 2008 13:14:09 +0200 Received: from (unknown [192.168.210.209]) by scmgateway.newtec.be with smtp id 530d_6f701380_74f2_11dd_bb55_00188b32e08b; Thu, 28 Aug 2008 13:14:09 +0200 Received: from gagh (gagh.ehv.newtec.eu [192.168.210.148]) by betur.newtec.eu with ESMTP; Thu, 28 Aug 2008 13:14:04 +0200 Received: by gagh (Postfix, from userid 1001) id 2AF907EA0F; Thu, 28 Aug 2008 13:14:05 +0200 (CEST) Date: Thu, 28 Aug 2008 13:14:05 +0200 To: grub-devel@gnu.org Message-ID: <20080828111405.GD8224@gagh.ehv.newtec.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) From: hans.lambermont@newtec.eu (Hans Lambermont) X-NAI-Spam-Score: 0 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Jan Derk Gerlings Subject: grub 1.96 svn 20080813 and circular lvm2 metadata X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2008 11:14:38 -0000 Hi all, My colleague Jan Derk Gerlings found a bug in the way grub 1.96, svn version 20080813 (and earlier) reads the circular lvm2 metadata buffer. If the lvm2 metadata is too large to fit in the buffer given an offset, then it is continued at the start of the buffer. In this case the current grub-setup will exit with a segmentation fault and on boot grub will not find the root drive. The origin of this bug is traced to the way grub handles lvm2 metadata. Lvm2 has defined (and uses) the on-disk metadata as a circular list. Each change to the metadate (lvm lvchange, lvm create, lvm remove, etc.) forces lvm to write the complete metadata to the circular buffer. It will be placed after the last instance of the metadata with a new sequence number. When the end of the buffer is reached, lvm will continue (wrap-around to) at the start of the buffer. Grub treats the buffer as linear, so when wrap-around occurs grub fails because it does not continue at the start of the buffer. This results in the grub-setup segmentation error, and the inability to boot. On request we can send two (literal) copies of the circular buffer (it's too big for the mailing list 100kibi limit). In md0_ok.txt the latest sequence number of the metadata is 280. It ends before it reaches the end of the buffer. Grub-install works and the machine boots. In md0_err the latest sequence number of the metadata is 282. It wraps around at the end of the buffer, continuing at the start of the buffer. The end of the metadata comes before the start. Grub-install fails and so does the boot. At grub-1.96_svn20080813/disk/lvm.c line 303 and further down the notion of circular metadata is not taken into account. Shall we attempt to fix this and send a patch ? regards, Hans Lambermont, Jan Derk Gerlings -- Hans Lambermont, M.Sc. - Newtec - OS-Platform&VAS http://newtec.eu/ t:+31408519234 m:+31629064887