From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MJv0w-00068k-2A for mharc-grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJv0u-00068b-BZ for grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJv0q-000681-Hi for grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:40 -0400 Received: from [199.232.76.173] (port=47133 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJv0q-00067s-C0 for grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:36 -0400 Received: from mx20.gnu.org ([199.232.41.8]:18547) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MJv0p-0004ND-A3 for grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:35 -0400 Received: from c60.cesmail.net ([216.154.195.49]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJv0m-0007le-2f for grub-devel@gnu.org; Thu, 25 Jun 2009 15:53:32 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 25 Jun 2009 15:53:30 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id 1129B34C69 for ; Thu, 25 Jun 2009 15:53:30 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090624231005.GA30986@thorin> References: <20090621181748.GA21152@thorin> <20090622230751.GD11998@thorin> <1245720581.30815.11.camel@mj> <20090623113850.GB24028@thorin> <20090623121325.GA3130@thorin> <20090624010032.GA19305@thorin> <20090624231005.GA30986@thorin> Content-Type: text/plain Date: Thu, 25 Jun 2009 15:53:28 -0400 Message-Id: <1245959608.18261.64.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) Content-Transfer-Encoding: 7bit X-Detected-Operating-System: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: Re: [PATCH] fix for loading modules from read-only memory area (Re: clean patch for i386-qemu port (Re: [PATCH] i386-qemu port)) 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: Thu, 25 Jun 2009 19:53:40 -0000 On Thu, 2009-06-25 at 01:10 +0200, Robert Millan wrote: > On Wed, Jun 24, 2009 at 03:00:32AM +0200, Robert Millan wrote: > > A possible solution to this could be to make grub_dl_load_core() create a > > copy of the module and work on the copy. This could even be ifdef'ed, > > but I doubt the performance hit would be significant. > > I found a better approach; instead of copiing the whole module, we just > need to copy the symbol tab. A small adjustment to each of the functions > that will access it (grub_dl_resolve_symbols and > grub_arch_dl_relocate_symbols) will make them use the copy instead of > the original. Massive use of undef seems inelegant. Maybe it's better to use distinctive names instead, e.g. target_Elf_Ehdr v.s. host_Elf_Ehdr? Also, I'm getting many warnings on i386-pc about redefined Elf_Ehdr when compiling on x86_64. Generally, I like the idea for i386-qemu, but for other architectures, the only change is the increased memory consumption. I would be willing to accept this change if you could suggest some universal benefit for all platforms. Otherwise, it would be better to use wrappers like get_header() and put_header() what would do grub_malloc() and grub_free() only if needed and return the original header otherwise. I'm fine with adding the symtab field unconditionally, it doesn't cost much memory. -- Regards, Pavel Roskin