[Top][All Lists]

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

Re: [Patch] Discard incorrect nested partitions (fixes #29956)

From: Seth Goldberg
Subject: Re: [Patch] Discard incorrect nested partitions (fixes #29956)
Date: Thu, 27 May 2010 18:10:16 -0700 (PDT)
User-agent: Alpine 2.00 (GSO 1167 2008-08-23)

This patch will also fix (i.e. Solaris), which embeds a copy of the MBR's partition table in the PBR.


Quoting Grégoire Sutre, who wrote the following on Fri, 28 May 2010:


Regarding the nested partition code, there is an implicit assumption
that each partition should be contained in its parent, i.e. its sectors
should also be sectors of its parent.

This ``physical nesting'' is checked in grub_disk_read, but it would
be better to check it before that.

The attached patch discards partitions that are invalid w.r.t. physical
nesting.  This solves, in particular, a problem related to NetBSD (and
OpenBSD) disklabels.

With this patch, ``external'' partitions in a disklabel simply do not
show up as BSD partitions.  For instance (see bug #29956 for an image):

MBR Partition table:
0: NetBSD    start 32, size 1000
1: DOS       start 1040, size 1000

NetBSD Disklabel (stored in MBR partition 0)
5 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
a:      1000        32     4.2BSD
c:      1000        32     unused
d:      2048         0     unused
e:      1000      1040      MSDOS

The e: partition is external: it is not contained in MBR NetBSD

Without the patch, we get:

$ grub-probe -m /dev/null -t drive -d /dev/rvnd0e
(/dev/rvnd0d,1,5)   # this is (/dev/rvnd0d,msdos1,bsd5)
$ grub-probe -m /dev/null -t fs -d /dev/rvnd0e
grub-probe: error: unknown filesystem.

With the patch, we get:

niagara# grub-probe -m /dev/null -t drive -d /dev/rvnd0e
(/dev/rvnd0d,2)   # this is (/dev/rvnd0d,msdos2)
niagara# grub-probe -m /dev/null -t fs -d /dev/rvnd0e

The patch still accepts sub-partitions that start at the same
(absolute) offset as the parent.  For instance, in the above example,
ls -l in grub gives both (hd1,msdos1) and (hd1,msdos1,bsd1).  Should
we discard (hd0,msdos1,bsd1), i.e. require that sub-partitions start
at a strictly positive relative offset?


reply via email to

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