[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
kernel/1449: kernel construct invalid disklabel
>Number: 1449
>Category: kernel
>Synopsis: kernel construct invalid disklabel
>Confidential: no
>Severity: non-critical
>Priority: high
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 14 19:00:02 MDT 2000
>Last-Modified:
>Originator: Grigoriy Orlov
>Organization:
>Release: 2.8-current
>Environment:
System : OpenBSD 2.8-current 07.09.2000
Architecture: OpenBSD.i386
Machine : i686
>Description:
If within dos mbr, behind extended partition exist the other partition,
then offset of such partition in disklabel would be more by value
of extended partition start.
For example:
$ fdisk wd1
Disk: wd1 geometry: 525/64/63 [2116800 sectors]
Offset: 0 Signatures: 0xAA55,0x0
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
-------------------------------------------------------------------------
0: 06 0 1 1 - 32 63 63 [ 63 - 132993] DOS > 32MB
1: 05 33 0 1 - 236 63 63 [ 133056 - 822528] Extended DOS
2: 82 237 0 1 - 253 63 63 [ 955584 - 68544] Linux swap
3: 83 254 0 1 - 524 63 63 [ 1024128 - 1092672] Linux files*
Offset: 133056 Signatures: 0xAA55,0x0
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
-------------------------------------------------------------------------
0: 06 33 1 1 - 83 63 63 [ 133119 - 205569] DOS > 32MB
1: 05 84 0 1 - 134 63 63 [ 338688 - 205632] Extended DOS
2: 00 33 0 1 - 32 63 63 [ 133056 - 0] unused
3: 00 33 0 1 - 32 63 63 [ 133056 - 0] unused
Offset: 338688 Signatures: 0xAA55,0x0
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
-------------------------------------------------------------------------
0: 06 84 1 1 - 134 63 63 [ 338751 - 205569] DOS > 32MB
1: 05 135 0 1 - 185 63 63 [ 544320 - 205632] Extended DOS
2: 00 84 0 1 - 83 63 63 [ 338688 - 0] unused
3: 00 84 0 1 - 83 63 63 [ 338688 - 0] unused
Offset: 544320 Signatures: 0xAA55,0x0
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
-------------------------------------------------------------------------
0: 06 135 1 1 - 185 63 63 [ 544383 - 205569] DOS > 32MB
1: 05 186 0 1 - 236 63 63 [ 749952 - 205632] Extended DOS
2: 00 135 0 1 - 134 63 63 [ 544320 - 0] unused
3: 00 135 0 1 - 134 63 63 [ 544320 - 0] unused
Offset: 749952 Signatures: 0xAA55,0x0
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
-------------------------------------------------------------------------
0: 06 186 1 1 - 236 63 63 [ 750015 - 205569] DOS > 32MB
1: 00 186 0 1 - 185 63 63 [ 749952 - 0] unused
2: 00 186 0 1 - 185 63 63 [ 749952 - 0] unused
3: 00 186 0 1 - 185 63 63 [ 749952 - 0] unused
$ disklabel wd1
disklabel: warning, DOS partition table with no valid OpenBSD partition
# /dev/rwd1c:
type: ESDI
disk: ESDI/IDE disk
label: DPEA-31080
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 2100
total sectors: 2116992
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg]
c: 2116992 0 unused 0 0 # (Cyl. 0 - 2100*)
i: 132993 63 MSDOS # (Cyl. 0*- 131)
j: 68544 1088640 unknown # (Cyl. 1080 - 1147)
k: 1092672 1157184 ext2fs # (Cyl. 1148 - 2231)
l: 205569 133119 MSDOS # (Cyl. 132*- 335)
m: 205569 338751 MSDOS # (Cyl. 336*- 539)
n: 205569 544383 MSDOS # (Cyl. 540*- 743)
o: 205569 750015 MSDOS # (Cyl. 744*- 947)
disklabel: partition k: partition extends past end of unit
$
In this example j and k entry(linux swap and linux ext2) have invalid
offset. True offset must be less 133056 (start of extended dos).
True disklabel :
# size offset fstype [fsize bsize cpg]
c: 2116992 0 unused 0 0 # (Cyl. 0 - 2100*)
i: 132993 63 MSDOS # (Cyl. 0*- 131)
j: 68544 955584 unknown # (Cyl. 948 - 1015)
k: 1092672 1024128 ext2fs # (Cyl. 1016 - 2099)
l: 205569 133119 MSDOS # (Cyl. 132*- 335)
m: 205569 338751 MSDOS # (Cyl. 336*- 539)
n: 205569 544383 MSDOS # (Cyl. 540*- 743)
o: 205569 750015 MSDOS # (Cyl. 744*- 947)
>How-To-Repeat:
>Fix:
Similar patch need to be aplied to the next arches:
alpha hppa i386 mips powerpc wgrisc
In hppa and wgrisc also forgotten DOSPTYP_EXTENDL label.
Index: disksubr.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/disksubr.c,v
retrieving revision 1.39
diff -u -r1.39 disksubr.c
--- disksubr.c 2000/07/07 17:17:54 1.39
+++ disksubr.c 2000/10/14 23:32:21
@@ -54,7 +54,7 @@
/*
* Attempt to read a disk label from a device
- * using the indicated stategy routine.
+ * using the indicated strategy routine.
* The label must be partly set up before this:
* secpercyl, secsize and anything required for a block i/o read
* operation in the driver's strategy/start routines
@@ -123,6 +123,8 @@
while (wander && n < 8 && loop < 8) {
loop++;
wander = 0;
+ if (part_blkno < extoff)
+ part_blkno = extoff;
/* read boot record */
bp->b_blkno = part_blkno;
@@ -229,8 +231,10 @@
case DOSPTYP_EXTEND:
case DOSPTYP_EXTENDL:
part_blkno = get_le(&dp2->dp_start) + extoff;
- if (!extoff)
+ if (!extoff) {
extoff = get_le(&dp2->dp_start);
+ part_blkno = 0;
+ }
wander = 1;
break;
default:
>Audit-Trail:
>Unformatted: