Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1DlCn7-0006aK-Cr for mharc-grub-devel@gnu.org; Wed, 22 Jun 2005 17:29:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DlCn5-0006Zw-NY for grub-devel@gnu.org; Wed, 22 Jun 2005 17:29:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DlCkN-0006Ft-39 for grub-devel@gnu.org; Wed, 22 Jun 2005 17:27:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DlCkG-00068A-Sq for grub-devel@gnu.org; Wed, 22 Jun 2005 17:26:52 -0400 Received: from [130.104.239.239] (helo=sprbodj.inma.ucl.ac.be) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DlCat-0000sl-BX for grub-devel@gnu.org; Wed, 22 Jun 2005 17:17:11 -0400 Received: from inma.ucl.ac.be (localhost.localdomain [127.0.0.1]) by sprbodj.inma.ucl.ac.be (Postfix) with ESMTP id 08DB219C840D for ; Wed, 22 Jun 2005 23:13:50 +0200 (CEST) From: "Vincent Guffens" To: grub-devel@gnu.org Date: Wed, 22 Jun 2005 23:13:50 +0200 Message-Id: <20050622210353.M3714@auto.ucl.ac.be> X-Mailer: Open WebMail 2.51 20050228 X-OriginatingIP: 213.213.238.70 (guffens) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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: free magic is broken 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: Wed, 22 Jun 2005 21:29:47 -0000 Hi, I have made a small test program that uses the memory management of grub2 to manage an allocated buffer and I can reproduce the free magic is broken problem with it. I have prepared a small web page with some details as it is a little bit long to explain here. See it there if you want more information: http://www.auto.ucl.ac.be/~guffens/grub2_netboot/free_magic_broken.html I propose the following patch to fix this problem. This patch will modify the mm code of grub2 only when the problem would occur in subsequent call to grub_free: diff -ru grub2/kern/mm.c grub2_free_magic_broken/kern/mm.c --- grub2/kern/mm.c 2005-01-20 18:25:39.000000000 +0100 +++ grub2_free_magic_broken/kern/mm.c 2005-06-22 22:59:58.660577232 +0200 @@ -298,6 +298,10 @@ p->next->magic = 0; p->size += p->next->size; p->next = p->next->next; + if (q->magic != GRUB_MM_FREE_MAGIC) { + r->first = p; + return; + } } if (q + q->size == p) -- Vincent Guffens UCL/CESAME +32 10 47 80 30 Euler Building A017