Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jun 2004 00:19:31 -0700
From:      Arun Sharma <arun@freebsd.org>
To:        freebsd-ia64@freebsd.org
Subject:   Clobbering foreign partitions
Message-ID:  <20040627071931.GA25902@sharma-home.net>

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

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

libdisk seems to have a bug which causes it to corrupt the GPT table in the presence of foreign partitions. 

Description:

Consider a GPT with the following partitions:

- EFI system (da0p1)
- Linux (da0p2)

When libdisk opens the disk and creates a list of chunks, it ignores
da0p2, because it's an "unknown" type. In other words, there is only
one chunk. The rest is "unused".

Subsequently, sysinstall doesn't display da0p2 (which I think is ok),
but allows the user to create a FreeBSD partition on da0p2.

I think the intended behavior is to ignore foreign partitions in
sysinstall UI, but take care not to clobber them in Write_Disk().

The attached patch changes the policy on ia64 only and correctly handles the above situation.

	-Arun

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="libdisk-ia64-policy.patch"

Index: chunk.c
===================================================================
RCS file: /net/eagle/home/scratch/freebsd/src/lib/libdisk/chunk.c,v
retrieving revision 1.51
diff -u -r1.51 chunk.c
--- chunk.c	21 Apr 2004 23:21:13 -0000	1.51
+++ chunk.c	27 Jun 2004 07:00:29 -0000
@@ -272,6 +272,7 @@
 		case fat:
 		case efi:
 		case mbr:
+		default:
 			c1 = Find_Mother_Chunk(d->chunks, offset, end, whole);
 			break;
 		case part:
@@ -281,8 +282,6 @@
 				c1 = Find_Mother_Chunk(d->chunks, offset, end,
 				    whole);
 			break;
-		default:
-			return (-1);
 		}
 		break;
 	case p_pc98:

--HlL+5n6rz5pIUxbD--



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