Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jun 2009 21:51:58 +0400
From:      Yuri Pankov <yuri.pankov@gmail.com>
To:        freebsd-current@freebsd.org
Subject:   Re: loader panics with 2 GPT partitioned drives
Message-ID:  <20090606175158.GA1080@darklight.homeunix.org>
In-Reply-To: <20090606021835.GC1077@darklight.homeunix.org>
References:  <20090606021835.GC1077@darklight.homeunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Jun 06, 2009 at 06:18:35AM +0400, Yuri Pankov wrote:
> Hi,
> 
> I'm getting the following "panic" from loader when trying to attach
> another GPT partitioned drive. loader is built using LOADER_ZFS_SUPPORT.
> 
> BTX Loader 1.00  BTX version is 1.02
> Consoles: internal video/keyboard
> BIOS drive C: is disk0
> BIOS drive D: is disk1
> 
> panic:free: guard1 fail @ 0x7fd4b3f4 from
> /usr/src/sys/boot/i386/libi386/biosdisk.c:1048
> 
> 
> ad4:
> =>       34  488397101  ad4  GPT  (233G)
>          34        128    1  freebsd-boot  (64K)
>         162   16777216    2  freebsd-swap  (8.0G)
>    16777378  471619757    3  freebsd-zfs  (225G)
> 
> ad10:
> empty disk, `gpart create -s GPT ad10`
> 
> 
> 
> Yuri

Looks like there are no checks in loader with GPT support if there are
no partitions defined (very rare case, but still.. :-). Attached patch
fixes booting with GPT disk without partitions (for me).


Yuri

--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="biosdisk.c.diff"

Index: biosdisk.c
===================================================================
--- biosdisk.c	(revision 193589)
+++ biosdisk.c	(working copy)
@@ -990,7 +990,8 @@
 
 out:
     if (error) {
-	free(od->od_partitions);
+	if (od->od_nparts > 0)
+		free(od->od_partitions);
 	od->od_flags &= ~BD_GPTOK;
     }
     return (error);
@@ -1044,7 +1045,7 @@
 	delay(3000000);
 #endif
 #ifdef LOADER_GPT_SUPPORT
-    if (od->od_flags & BD_GPTOK)
+    if (od->od_flags & BD_GPTOK && od->od_nparts > 0)
 	free(od->od_partitions);
 #endif
     free(od);

--2fHTh5uZTiUOsy+g--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090606175158.GA1080>