From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MXj8s-0004jA-3b for mharc-grub-devel@gnu.org; Sun, 02 Aug 2009 18:02:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXj8q-0004hD-4U for grub-devel@gnu.org; Sun, 02 Aug 2009 18:02:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXj8l-0004df-Pb for grub-devel@gnu.org; Sun, 02 Aug 2009 18:02:55 -0400 Received: from [199.232.76.173] (port=39332 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXj8l-0004dR-GN for grub-devel@gnu.org; Sun, 02 Aug 2009 18:02:51 -0400 Received: from xvm-190-8.ghst.net ([217.70.190.8]:54701 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MXj8j-0001WO-UK for grub-devel@gnu.org; Sun, 02 Aug 2009 18:02:51 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1MXj8X-0003cq-C0 for grub-devel@gnu.org; Mon, 03 Aug 2009 00:02:37 +0200 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1MXj8W-00052T-PO for grub-devel@gnu.org; Mon, 03 Aug 2009 00:02:36 +0200 Date: Mon, 3 Aug 2009 00:02:36 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090802220236.GG15139@thorin> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] nested partitions 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: Sun, 02 Aug 2009 22:02:56 -0000 On Thu, Jul 16, 2009 at 10:52:37PM +0200, Vladimir 'phcoder' Serbinenko wrote: > @@ -94,10 +95,28 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags) > dev = grub_device_open (0); > if (dev && dev->disk && dev->disk->partition) > { > - grub_disk_read (dev->disk, dev->disk->partition->offset, 446, 64, > - (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); > - part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR > - + (dev->disk->partition->index << 4)); > + grub_disk_t disk = dev->disk; > + > + if (disk) > + { > + grub_partition_t p = disk->partition; > + > + /* In i386-pc, the id is equal to the BIOS drive number. */ > + drive = (int) disk->id; > + > + if (p && grub_strcmp (p->partmap->name, "pc_partition_map") == 0) > + { > + disk->partition = p->parent; > + grub_disk_read (disk, p->offset, 446, 64, > + (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); > + part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR > + + (((struct grub_pc_partition *) p->data) > + ->index << 4)); > + disk->partition = p; > + } > + } > + > + grub_device_close (dev); I don't think we should allow chainload at all in partitions other than msdos ones. There's no existing use of this for other labels "in the wild", and we shouldn't encourage it to appear IMO. If we have partitions and the "pc_partition_map" match fails, I would just abort. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."