From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OJA4M-0004Z7-E7 for mharc-grub-devel@gnu.org; Mon, 31 May 2010 14:50:38 -0400 Received: from [140.186.70.92] (port=47598 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJA4J-0004Nw-47 for grub-devel@gnu.org; Mon, 31 May 2010 14:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJ9pr-0001vj-OC for grub-devel@gnu.org; Mon, 31 May 2010 14:35:41 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:60678) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ9pr-0001vU-Js for grub-devel@gnu.org; Mon, 31 May 2010 14:35:39 -0400 Received: by ewy8 with SMTP id 8so1032604ewy.8 for ; Mon, 31 May 2010 11:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=vFXQW2cAoWF0aavyYUW7ih8FoQNjIqkKMJvwudrXrGk=; b=KrzolKZLdEcvmcppy/hxsckMxSyihww4/a21Ip+kex1o4gerr2B2m6Jarv+CHW9XYT NdSjR8/KPVU1fF00bVMhDaAtyca/uL8f/1+Zq+C5UGX8HFAzaZ6+HCUUlZ3FyDldnCc9 rZyT52oaohCJKOka4uLWcQLJEN31ocwE7yIko= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=LdemTU2yiPHOsHy3Nhe4Y2lhgOZu5GL/CLMoVPvueVKUL86kJtApFZwVELKxTAB5mA CA/vPPjsctj56PH0ueKS+6g38sr5kp88PloWup/25kDghbQi4ZJPW7WTHq8AIbqkCmNp JeonJddiTBwAqATGSQSyaiAORKj5v3fFkWtg8= Received: by 10.213.108.73 with SMTP id e9mr2294357ebp.42.1275330938647; Mon, 31 May 2010 11:35:38 -0700 (PDT) Received: from debian.bg45.phnet (gprs57.swisscom-mobile.ch [193.247.250.57]) by mx.google.com with ESMTPS id 15sm3214542ewy.0.2010.05.31.11.35.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 11:35:36 -0700 (PDT) Message-ID: <4C040166.3030502@gmail.com> Date: Mon, 31 May 2010 20:35:18 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GNU GRUB References: <4BFF1337.3020100@gmail.com> In-Reply-To: <4BFF1337.3020100@gmail.com> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig72FB95815551E0B77CA635AD" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [Patch] Discard incorrect nested partitions (fixes #29956) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 18:50:36 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig72FB95815551E0B77CA635AD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Gr=C3=A9goire Sutre wrote: > Hi, > > 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. There are few ramifications of this patch. First of all some partitions which are just barely outside of the host partition will lead to something like "partition not found" errors in grub-probe. This message should be more informative (the easiest way is to issue a warning in grub-probe if partitions are discarded except some cases where it's known not to affect the functionality like 'd' "subpartitions", probably such a warning in grub proper would be too annoying though). Then if you check partitions when iterating no need to recheck in adjust_range. > > 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 > partition. > > 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 > fat > > > 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? No. SUN partitions comonly start at offset 0. > > > Gr=C3=A9goire > > -----------------------------------------------------------------------= - > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig72FB95815551E0B77CA635AD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAkwEAW0ACgkQNak7dOguQglYcAD+OhNI+54vJOUkckmp/KtHZYIL BAu0l7V57G9kGFr0znMA/jX8m0pVNdZBwWauY0gyXbAwDw9QVP3y41VpXJHzP9wW =7SBl -----END PGP SIGNATURE----- --------------enig72FB95815551E0B77CA635AD--