Mercurial > illumos > illumos-gate
changeset 4304:cb8b0d33b082
6466433 Default EFI slice table leaves one sector unused.
6474622 auto configure to a EFI labeled lun should generate a whole hog partition table
6537609 validate64 function reads past the end of efi->parts
author | yl194034 |
---|---|
date | Wed, 23 May 2007 22:18:37 -0700 |
parents | 6dc328847ed0 |
children | 1e1c1efdc717 |
files | usr/src/cmd/fmthard/fmthard.c usr/src/cmd/format/auto_sense.c usr/src/cmd/format/label.c |
diffstat | 3 files changed, 28 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/fmthard/fmthard.c Wed May 23 17:37:03 2007 -0700 +++ b/usr/src/cmd/fmthard/fmthard.c Wed May 23 22:18:37 2007 -0700 @@ -31,7 +31,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -824,7 +824,7 @@ if (efi->efi_parts[i].p_tag != V_BACKUP && efi->efi_parts[i].p_size != fullsz) { - for (j = 0; j < V_NUMPAR; j++) { + for (j = 0; j < efi->efi_nparts; j++) { if (efi->efi_parts[j].p_size == fullsz) continue; isize = efi->efi_parts[i].p_size;
--- a/usr/src/cmd/format/auto_sense.c Wed May 23 17:37:03 2007 -0700 +++ b/usr/src/cmd/format/auto_sense.c Wed May 23 22:18:37 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -272,37 +272,33 @@ label->e_parts = vtoc; - for (i = 0; i < min(vtoc->efi_nparts, V_NUMPAR); i++) { - vtoc->efi_parts[i].p_tag = default_vtoc_map[i].p_tag; - vtoc->efi_parts[i].p_flag = default_vtoc_map[i].p_flag; + /* + * Create a whole hog EFI partition table: + * S0 takes the whole disk except the primary EFI label, + * backup EFI label, and the reserved partition. + */ + vtoc->efi_parts[0].p_tag = V_USR; + vtoc->efi_parts[0].p_start = vtoc->efi_first_u_lba; + vtoc->efi_parts[0].p_size = vtoc->efi_last_u_lba - vtoc->efi_first_u_lba + - EFI_MIN_RESV_SIZE + 1; + + /* + * S1-S6 are unassigned slices. + */ + for (i = 1; i < vtoc->efi_nparts - 2; i ++) { + vtoc->efi_parts[i].p_tag = V_UNASSIGNED; vtoc->efi_parts[i].p_start = 0; vtoc->efi_parts[i].p_size = 0; } - /* - * Make constants first - * and variable partitions later - */ - - /* root partition - s0 128 MB */ - vtoc->efi_parts[0].p_start = 34; - vtoc->efi_parts[0].p_size = 262144; - - /* partition - s1 128 MB */ - vtoc->efi_parts[1].p_start = 262178; - vtoc->efi_parts[1].p_size = 262144; - /* partition -s2 is NOT the Backup disk */ - vtoc->efi_parts[2].p_tag = V_UNASSIGNED; + /* + * The reserved slice + */ + vtoc->efi_parts[vtoc->efi_nparts - 1].p_tag = V_RESERVED; + vtoc->efi_parts[vtoc->efi_nparts - 1].p_start = + vtoc->efi_last_u_lba - EFI_MIN_RESV_SIZE + 1; + vtoc->efi_parts[vtoc->efi_nparts - 1].p_size = EFI_MIN_RESV_SIZE; - /* partition -s6 /usr partition - HOG */ - vtoc->efi_parts[6].p_start = 524322; - vtoc->efi_parts[6].p_size = vtoc->efi_last_u_lba - 524322 - - (1024 * 16); - - /* efi reserved partition - s9 16K */ - vtoc->efi_parts[8].p_start = vtoc->efi_last_u_lba - (1024 * 16); - vtoc->efi_parts[8].p_size = (1024 * 16); - vtoc->efi_parts[8].p_tag = V_RESERVED; /* * Now stick all of it into the disk_type struct */
--- a/usr/src/cmd/format/label.c Wed May 23 17:37:03 2007 -0700 +++ b/usr/src/cmd/format/label.c Wed May 23 22:18:37 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -234,7 +234,7 @@ efi->efi_parts[0].p_tag = V_USR; efi->efi_parts[0].p_start = efi->efi_first_u_lba; efi->efi_parts[0].p_size = efi->efi_last_u_lba - efi->efi_first_u_lba - - EFI_MIN_RESV_SIZE; + - EFI_MIN_RESV_SIZE + 1; /* * s1-s6 are unassigned slices @@ -250,7 +250,7 @@ */ efi->efi_parts[efi->efi_nparts - 1].p_tag = V_RESERVED; efi->efi_parts[efi->efi_nparts - 1].p_start = - efi->efi_last_u_lba - EFI_MIN_RESV_SIZE; + efi->efi_last_u_lba - EFI_MIN_RESV_SIZE + 1; efi->efi_parts[efi->efi_nparts - 1].p_size = EFI_MIN_RESV_SIZE; return (0);