From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PWyZ6-0001lT-Vy for mharc-grub-devel@gnu.org; Sun, 26 Dec 2010 16:55:45 -0500 Received: from [140.186.70.92] (port=46147 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PWyZ3-0001eJ-Au for grub-devel@gnu.org; Sun, 26 Dec 2010 16:55:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PWyYy-0003jy-DC for grub-devel@gnu.org; Sun, 26 Dec 2010 16:55:41 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:57057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PWyYy-0003jn-8X for grub-devel@gnu.org; Sun, 26 Dec 2010 16:55:36 -0500 Received: by fxm12 with SMTP id 12so2191878fxm.0 for ; Sun, 26 Dec 2010 13:55:35 -0800 (PST) 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=vzaVWf/PkF2Ilw8Ydt+C/njA3mghZVAJ2605+h4EcrE=; b=Xo2MX43+Liz4wmk2oqOBMAC1dwuFsTNdi8FBWVa8RY8eGflkKfugfts7c9942f1G1F z5A/6ZZGK5fBejftRCKOd/raDskWkcqfXbL0HuDwJtYvJDegjvTHSH2PzoDFyEtx38UV +kuzKWW/R5nviV9+WGYEaKAoIrzaODHs6gABE= 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=G6lGiZDTUZZhyum31qFvvaPKsRMZzVsxRDZVnyfynNiGQVDAPcZDyNJobPTGj2yMUd 2z3Q7NFTdNaxOgOrIpZ8BRXy/i8PZVkcKi08VtSGRPuBS8+o4aClNBwWL6d7U6oBj7YK rjXhKSVbB354QNSZEgHdk9ncU4/d4pR+VLjzE= Received: by 10.223.71.199 with SMTP id i7mr4599562faj.57.1293400535021; Sun, 26 Dec 2010 13:55:35 -0800 (PST) Received: from debian.bg45.phnet (gprs55.swisscom-mobile.ch [193.247.250.55]) by mx.google.com with ESMTPS id f24sm2840907fak.24.2010.12.26.13.55.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 26 Dec 2010 13:55:34 -0800 (PST) Message-ID: <4D17B9C8.8080301@gmail.com> Date: Sun, 26 Dec 2010 22:55:20 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101211 Icedove/3.0.11 MIME-Version: 1.0 To: grub-devel@gnu.org References: <201012262115.oBQLFpQL072419@m5p.com> In-Reply-To: <201012262115.oBQLFpQL072419@m5p.com> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig889D7F4D4BCBE2B27EE81C90" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Two Small Patches (x86 VolId & Sun Label Checking) 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: Sun, 26 Dec 2010 21:55:44 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig889D7F4D4BCBE2B27EE81C90 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/26/2010 10:15 PM, ehem+grub@m5p.com wrote: >> From: Vladimir '?-coder/phcoder' Serbinenko >> On 12/26/2010 06:29 AM, ehem+grub@m5p.com wrote: >> =20 >>> I will in fact be implementing breaking detection functions into dist= inct >>> functions uniformly, >>> =20 >> I'm not fond of "let's change it just because we can". There are much >> more real tasks on the project. Come to #grub and I'm sure will find >> something for you. >> =20 >>> because there is a deeper issue lurking here. Looks >>> to be pure luck no one ran into an unpleasant bug lurking in the exis= ting >>> design. >>> >>> =20 >>> =20 >> Please show me the real problem then. >> =20 > Quite simple, the disk slice scheme detection routines vary in the > quality of their detection. In particular, the MSDOS-style detection is= > *extremely* brittle. The only even mildly distinguishing characteristic= > it finds is ensuring only the msb of the boot-flag byte is set. The oth= er > thing it looks for is the 0xAA55 signature, but that is merely a signal= > to PC-BIOSes that the disk is bootable; as such *any* bootable disk for= a > IBM-PC will have that signature, whether or not it is actually using th= e > MSDOS-style header. A 1 in 65536 chance of a false positive is bad. > > =20 Actually 1 in 2^(7*4+16) =3D2^44 in you take into account the both checks= and consider every possible sector equiprobable. While this is a problem, it's design problem of this partitioning label. More sanity checks are possible but they would be heuristics and increase the possibility of false negative. So every additional sanity check is to be considered on case-by-case basis. > Whereas most of the other schemes have actual magic numbers for the > disk-slice scheme, that is *not* merely a flag for whether it is okay t= o > boot from or not (plus checksums, which push them to 1 in 2^32 chance o= f > incorrect detection). > > Take a look at the attached file, it is ment as a header for a 512KB > image (`dd if=3D/dev/zero count=3D1023 2>/dev/null | cat sample /dev/st= din > > full_sample`). The only reason it will be correctly detected as a > SunOS-style disk label is that routine gets tried first, the MSDOS-styl= e > detection would take it as valid. > > =20 Recent GRUB don't reject multiple disklabels per disk and you can access all the partitions described by all of them. E.g: (hd0,msdos1) vs (hd0,sun1) While false-positive looks ugly in ls and slows GRUB down (checking for filesystem in ghost partitions) it's only mildly affected. False negatives on the other hand may prevent GRUB from booting altogether > I do have a specific goal in mind. Perhaps oddball, but a definite goal= =2E > > > =20 Improving quality of partmap detection is a good goal but be aware of the price of heuristics. --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig889D7F4D4BCBE2B27EE81C90 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/ iF4EAREKAAYFAk0XucgACgkQNak7dOguQgm8jgEAl5OG+mbjScO5y0LVLspJ9csO 9g16A57rUsUz+a75efkA/00i1IdLyDTMs5pHyiQgX9yWdnx1cwzscx6q8/Ymp6gg =b0vV -----END PGP SIGNATURE----- --------------enig889D7F4D4BCBE2B27EE81C90--