Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1HoleC-0000Ct-MM for mharc-grub-devel@gnu.org; Thu, 17 May 2007 15:28:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HoleA-0000AZ-7q for grub-devel@gnu.org; Thu, 17 May 2007 15:28:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hole9-0000AB-2x for grub-devel@gnu.org; Thu, 17 May 2007 15:28:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hole9-0000A8-0P for grub-devel@gnu.org; Thu, 17 May 2007 15:28:21 -0400 Received: from neonescio.viaisn.org ([82.94.249.43]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HolW0-00046C-ID for grub-devel@gnu.org; Thu, 17 May 2007 15:19:56 -0400 Received: from dijkstra.dekkers.cx ([2001:960:7a0:0:213:d4ff:fe9c:2487] ident=Debian-exim) by neonescio.viaisn.org with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32 CV=0) (Exim 4.63 #1) id 1HolVy-0008Mx-Oh; Thu, 17 May 2007 21:19:54 +0200 Received: from localhost ([127.0.0.1] helo=dijkstra.dekkers.cx ident=jeroen) by dijkstra.dekkers.cx with esmtp (Exim 4.63) (envelope-from ) id 1HolVx-0000rx-Os; Thu, 17 May 2007 21:19:53 +0200 Date: Thu, 17 May 2007 21:19:53 +0200 Message-ID: <87fy5vb6li.wl@dekkers.cx> From: Jeroen Dekkers To: The development of GRUB 2 In-Reply-To: <87hcqb3h5t.fsf@xs4all.nl> References: <20070514090937.GA10895@aragorn> <200705161730.12968.florian@kriener.org> <20070516155526.GA24614@aragorn> <200705161918.19512.florian@kriener.org> <20070516200101.GB30550@aragorn> <87hcqb3h5t.fsf@xs4all.nl> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.7 Emacs/22.0.95 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-detected-kernel: Linux 2.6 (newer, 3) Cc: Florian Kriener , 423409@bugs.debian.org Subject: Re: double free() with grub-probe 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, 17 May 2007 19:28:22 -0000 At Thu, 17 May 2007 11:58:54 +0200, Marco Gerards wrote: > Hi Robert, > > > We got this bug report from Debian BTS. It seems to be related to LVM. > > > > The argc address in last line looks very suspicious; stack corruption? > > Can you try valgrind? The older valgrinds didn't work with GRUB 2, > but the newer ones do. I could reproduce this on one of my machines and ran it through valgrind. I've just committed a fix to the grub2 CVS repository (as well as another memory bug valgrind spotted). A copy of the patch is below. Jeroen Dekkers Index: kern/disk.c =================================================================== RCS file: /cvsroot/grub/grub2/kern/disk.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -p -r1.17 -r1.18 --- kern/disk.c 10 Nov 2006 23:31:55 -0000 1.17 +++ kern/disk.c 17 May 2007 19:03:42 -0000 1.18 @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2006 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2004,2006,2007 Free Software Foundation, Inc. * * GRUB is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -414,6 +414,8 @@ grub_disk_read (grub_disk_t disk, grub_d num = ((size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); + + tmp_buf = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS); if ((disk->dev->read) (disk, sector, num, tmp_buf)) { grub_error_push (); ============================================================