grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grub 1.96 svn 20080813 and circular lvm2 metadata


From: Hans Lambermont
Subject: grub 1.96 svn 20080813 and circular lvm2 metadata
Date: Thu, 28 Aug 2008 13:14:05 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]