Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Jdkfv-0005LK-VE for mharc-grub-devel@gnu.org; Mon, 24 Mar 2008 07:17:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jdkfs-0005KD-Aa for grub-devel@gnu.org; Mon, 24 Mar 2008 07:17:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jdkfq-0005JL-FC for grub-devel@gnu.org; Mon, 24 Mar 2008 07:17:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jdkfp-0005JF-Tz for grub-devel@gnu.org; Mon, 24 Mar 2008 07:17:06 -0400 Received: from ti-out-0910.google.com ([209.85.142.186]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jdkfp-0004ST-GG for grub-devel@gnu.org; Mon, 24 Mar 2008 07:17:05 -0400 Received: by ti-out-0910.google.com with SMTP id a20so611871tia.10 for ; Mon, 24 Mar 2008 04:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=XLsoblPrFSYM6rnC9TgRMOiH30WnIa7DrTXGbEwWNMU=; b=Ku4+Dx89DFRQYYvPptaXLM5iJe3evn98Y65KWIAq6h2Odz8X9bQ1B+mMmUNGiOjvhC6fvpbCWOpuhpcVWOHWfTC7rEv1vQE3NzlqEnYbHqY8a7LKk+/e4b/4Gp/UYfG0zTt3+GpwgGbD7ET+CbgpjlaJhhxAjz1C7Gv/dZ2eX88= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MBtobbHow2VOtUTCzumHTjDeDfL2r4IiZig+HJofg+L95gX5qmeTRUWHxt8ClSwapmZSDmK+fy0pzTimMTTD4vovMKG6506UIekI9aPUz9/WIGmy0GcsiMOKhEhHqgzp8GO0qQU7AOURJgT/Zprxt2eEEvxOuS6DTGazeDh9hKo= Received: by 10.110.39.16 with SMTP id m16mr1094297tim.59.1206357423366; Mon, 24 Mar 2008 04:17:03 -0700 (PDT) Received: by 10.110.62.19 with HTTP; Mon, 24 Mar 2008 04:17:03 -0700 (PDT) Message-ID: Date: Mon, 24 Mar 2008 19:17:03 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: <5cc84b460803210429j26398ffdnd9fa3856c287bf62@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5cc84b460803210429j26398ffdnd9fa3856c287bf62@mail.gmail.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: [PATCH] Silently ignore grub_file_read when p_filesz == 0 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: Mon, 24 Mar 2008 11:17:08 -0000 On Fri, Mar 21, 2008 at 7:29 PM, Kalamatee wrote: > After reading through the ELF specs > (http://www.muppetlabs.com/~breadbox/software/ELF.txt) its become clear that > a PT_LOAD with p_filesz == 0,is valid - and after checking some elf binaries > ive found a number of cases where this is true (including the bootstrap of > AROS64) > > please find a patch enclosed to change the behaviour of multiboot.c's elf > loader to silently ignore loading the data if p_filesz == 0 > > 2008-03-21 Kalamatee kalamatee@gmail.com > > * loader/i386/pc/multiboot.c > (grub_multiboot_load_elf32): If p_filesz == 0, do not attempt to > read data from the file. > (grub_multiboot_load_elf64): If p_filesz == 0, do not attempt to > read data from the file. I think the better way to fix this problem is to change grub_file_read itself, as using length 0 as a indicator to read until the end of file is not consistent with the standard read function, and it could easily cause buffer overflown problem. However, i don't know if any part of grub2 is actually rely on this feature, so need to check with it first. -- Bean