From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JlmuL-0006c2-1F for mharc-grub-devel@gnu.org; Tue, 15 Apr 2008 11:17:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JlmuH-0006ZH-Na for grub-devel@gnu.org; Tue, 15 Apr 2008 11:17:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JlmuE-0006Vt-CD for grub-devel@gnu.org; Tue, 15 Apr 2008 11:17:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JlmuE-0006VY-3Z for grub-devel@gnu.org; Tue, 15 Apr 2008 11:17:10 -0400 Received: from c60.cesmail.net ([216.154.195.49]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1JlmuD-0006Z0-T8 for grub-devel@gnu.org; Tue, 15 Apr 2008 11:17:10 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 15 Apr 2008 11:17:08 -0400 Received: from [192.168.1.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 7DD7461905A for ; Tue, 15 Apr 2008 11:17:08 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20080415131547.GB21548@thorin> References: <200804131734.50447.Chris.Knadle@coredump.us> <20080414120742.GB24443@thorin> <200804141021.49995.Chris.Knadle@coredump.us> <1208193649.4027.19.camel@dv> <20080415131547.GB21548@thorin> Content-Type: text/plain Date: Tue, 15 Apr 2008 11:17:07 -0400 Message-Id: <1208272627.14211.10.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-3.fc8) Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: grub-probe fails to find PC partition due to Apple disklabel 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: Tue, 15 Apr 2008 15:17:15 -0000 On Tue, 2008-04-15 at 15:15 +0200, Robert Millan wrote: > > partmap/apple.c starts reading with the second sector (unsigned pos = > > GRUB_DISK_SECTOR_SIZE). Perhaps it should read the first sector to > > check the magic. > > Are you sure checking for the code part would be a good idea? One could be > using i8088 bootstrap code in an Apple first sector, or vice-versa. Apple partition table requires the magic in the first two bytes of the first sector, followed by the sector size. Even if those instructions are survivable by x86 processors, executing data is a very bad hack. > Btw, how does Linux handle this? Maybe this issue has been beaten to death > already. fs/partitions/mac.c checks the magic in the first sector in mac_partition() fs/partitions/msdos.c doesn't check for the Apple magic, but it makes some other sanity checks. It rejects the partition table if any boot flags is not 0x00 or 0x80. It also refuses to accept the table if there is an EFI GPT partition. To fix the issue at hand (PC partition mistaken as Apple), all we need is to check the Apple magic in the Apple partition code. -- Regards, Pavel Roskin