Clobbering foreign partitions

Arun Sharma arun at freebsd.org
Sun Jun 27 00:19:44 PDT 2004


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
-------------- next part --------------
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:


More information about the freebsd-ia64 mailing list