Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Dd9uh-0007Li-OW for mharc-grub-devel@gnu.org; Tue, 31 May 2005 12:48:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dd9uf-0007Jy-3q for grub-devel@gnu.org; Tue, 31 May 2005 12:48:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dd9ud-0007Is-4E for grub-devel@gnu.org; Tue, 31 May 2005 12:48:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dd9uc-0007IB-B9 for grub-devel@gnu.org; Tue, 31 May 2005 12:48:18 -0400 Received: from [130.104.239.239] (helo=sprbodj.inma.ucl.ac.be) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dd9tj-000183-CL for grub-devel@gnu.org; Tue, 31 May 2005 12:47:23 -0400 Received: from [130.104.239.234] (pc-babaorom.inma.ucl.ac.be [130.104.239.234]) by sprbodj.inma.ucl.ac.be (Postfix) with ESMTP id 378E019C836C for ; Tue, 31 May 2005 18:45:28 +0200 (CEST) Message-ID: <429C949E.1080700@inma.ucl.ac.be> Date: Tue, 31 May 2005 18:45:18 +0200 From: Vincent Guffens User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 X-Accept-Language: en MIME-Version: 1.0 To: The development of GRUB 2 References: <429C6B12.4080608@inma.ucl.ac.be> In-Reply-To: <429C6B12.4080608@inma.ucl.ac.be> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-ucl-inma-MailScanner-Information: Please contact the ISP for more information X-ucl-inma-MailScanner: Found to be clean X-MailScanner-From: guffens@inma.ucl.ac.be Subject: Re: network support : memory management problem 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, 31 May 2005 16:48:21 -0000 it looks like the problem is gone. I changed the way I allocate the memory to hold a block. I changed from: int load_block () char * p = (char *) grub_malloc(len*sizeof(char)); to int load_block () char * p; [...] p = (char *) grub_malloc(len*sizeof(char)); but still, I would be interested in documentation about the memory layout and the memory management of grub2, if available. Thanks ! Vincent Guffens wrote: > Hi, > > I sent a similar e-mail yesterday but I think it didn't get through. > > I have a working version of the netboot support in grub2. I can issue > commands like (seeking in file is not yet possible): > > cat (nd0)test.txt > linux (nd0)linux24 > > but depending on where in the code I free my data blocks, I sometimes > get a "free magic is broken" fatal error msg from grub_free(). > > I found out that if I use the grub_printf() function just before the > call to grub_free(), the problem disappears. > > That is to say that in my grub_net_close function (the close file > function associated with the net binding file system), I do something like: > > struct grub_netfs_data * priv = (struct grub_netfs_data *) file->data; > struct grub_netfs_block *pp, * p = priv->head; > > grub_printf("FREEING\n"); > > if (p) > pp = p->next; > > while (p) { > if ((p->data)){ > grub_free(p->data); > } > > > If I remove the FREEING msg, I have the panic error message, otherwise, > everything looks fine. The exact error message is > > free magic is broken at 0x85900: 0x0 > > Does someone has an idea ? Is there some documentation available about > the mm in grub2 ? > > The full code is available on this web page: > http://www.auto.ucl.ac.be/~guffens/grub2_netboot/index.html > > -- Vincent Guffens PhD Student UCL/CESAME tel: +32 10 47 80 30 Value your freedom, or you will lose it, teaches history. "Don't bother us with politics," respond those who don't want to learn. -- Richard M. Stallman