Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2007 19:32:31 GMT
From:      Jo Rhett<jrhett@svcolo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/107829: invalid boundary checking in fdisk / wraps value of > 2TB filesystem.
Message-ID:  <200701111932.l0BJWVBZ047744@www.freebsd.org>
Resent-Message-ID: <200701111940.l0BJeFVf019171@freefall.freebsd.org>

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

>Number:         107829
>Category:       i386
>Synopsis:       invalid boundary checking in fdisk / wraps value of > 2TB filesystem.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 11 19:40:15 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Jo Rhett
>Release:        6.0-REL
>Organization:
Silicon Valley Colocation
>Environment:
FreeBSD arran 6.0-RELEASE FreeBSD 6.0-RELEASE #4
>Description:
Fdisk doesn't handle partition sizes greater than 2TB, no problem.  But it should either complain appropriately or just truncate numbers which exceed this limit.

Trying to create a 2.4TB partition gave me (without any warning) the following result.  This is consistent and repeatable at will.


[root@backup0 ~]# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=303934 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=303934 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 587732351 (286978 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 165/ sector 59
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

The same problem can be observed in interactive mode, where it actually shows negative numbers.



>How-To-Repeat:
root@arran 4# fdisk -u da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=9724 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=9724 heads=255 sectors/track=63 (16065 blks/cyl)

Do you want to change our idea of what BIOS thinks ? [n] 
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 156215997 (76277 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
Do you want to change it? [n] y
Supply a decimal value for "sysid (165=FreeBSD)" [165] 
Supply a decimal value for "start" [63] 
Supply a decimal value for "size" [156215997] 15621599700
fdisk: WARNING: partition does not end on a cylinder boundary
fdisk: WARNING: this may confuse the BIOS or some operating systems
Correct this automatically? [n] y
fdisk: WARNING: adjusting size of partition to 2736688752
Explicitly specify beg/end address ? [n] 
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 2736688752 (1336273 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 366/ head 254/ sector 63
Are we happy with this entry? [n] 
Supply a decimal value for "sysid (165=FreeBSD)" [165] 
Supply a decimal value for "start" [63] 
Supply a decimal value for "size" [-1558278544] 
>Fix:
Since fdisk is known to only handle 2tb partitions, the values input should be checked for validity and either rejected or simply truncated to 2tb.
>Release-Note:
>Audit-Trail:
>Unformatted:



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