From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1CxCBA-0007l2-FM for mharc-grub-devel@gnu.org; Fri, 04 Feb 2005 17:43:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CxCB7-0007jS-3r for grub-devel@gnu.org; Fri, 04 Feb 2005 17:43:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CxCB1-0007gY-12 for grub-devel@gnu.org; Fri, 04 Feb 2005 17:43:48 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CxCB0-0007cQ-5j for grub-devel@gnu.org; Fri, 04 Feb 2005 17:43:46 -0500 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CxBsu-0006bv-Ra for grub-devel@gnu.org; Fri, 04 Feb 2005 17:25:05 -0500 Received: from vscan-cn.han.nl (venus.han.nl [145.74.65.6]) by mail-cn.han.nl (Postfix) with ESMTP id 525DE8D96 for ; Fri, 4 Feb 2005 23:25:04 +0100 (CET) Received: from mail-cn.han.nl ([145.74.66.11]) by vscan-cn.han.nl (venus.han.nl [145.74.65.6]) (amavisd-new, port 10024) with ESMTP id 31294-02 for ; Fri, 4 Feb 2005 23:25:01 +0100 (CET) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id 56A97971B for ; Fri, 4 Feb 2005 23:25:01 +0100 (CET) Received: from marco.marco-g.com (mgerards.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id 0AC82C045 for ; Fri, 4 Feb 2005 23:25:01 +0100 (CET) Mail-Copies-To: metgerards@student.han.nl To: The development of GRUB 2 References: <20050201044708.GB3969@zulo.hadrons.org> From: Marco Gerards Date: Fri, 04 Feb 2005 22:25:03 +0000 In-Reply-To: <20050201044708.GB3969@zulo.hadrons.org> (Guillem Jover's message of "Tue, 1 Feb 2005 05:47:08 +0100") Message-ID: <87brb03qv4.fsf@marco.marco-g.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (2.2.0) at vscan-cn.han.nl Subject: Re: consolidate ELF header checks 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: Fri, 04 Feb 2005 22:43:54 -0000 Guillem Jover writes: Hi, > I've spoken with Marco about creating a new elf helper loader module > so other loaders can share common functions. Maybe later we can add > a.out or coff helper modules... Or maybe even move most of the > functionality from dl to the elf module. > > This patch merges common ELF header checks. Please test this on PPC > as I've only tested on x86. I've done that. I could load linux using this patch after a small change. > + if (size < sizeof (Elf_Ehdr)) > + return grub_error (GRUB_ERR_BAD_OS, "ELF size"); Please use a more descriptive error message. > + return grub_error (GRUB_ERR_BAD_OS, "Generic ELF magic"); Same here. > - /* Make sure that every section is within the core. */ > - if (size < e->e_shoff + e->e_shentsize * e->e_shnum) > - return 0; > + || e->e_machine != EM_386) > + return grub_error (GRUB_ERR_BAD_OS, "Arch ELF magic"); And here. > diff -Naupr -x CVS grub2-cvs/loader/powerpc/ieee1275/linux.c grub2.dl/loader/powerpc/ieee1275/linux.c > --- grub2-cvs/loader/powerpc/ieee1275/linux.c 2005-02-01 04:34:13.000000000 +0100 > +++ grub2.dl/loader/powerpc/ieee1275/linux.c 2005-02-01 04:03:26.000000000 +0100 > + if (grub_dl_check_header (ehdr, sizeof(ehdr))) The first ehdr should be &ehdr. As far as I am concerned there are no other issues with this patch. If someone else has problems with this patch, please tell me. Otherwise I will commit it soon, if Guillem can fix these issues... :) Thanks, Marco