From owner-freebsd-i386@FreeBSD.ORG Thu Jan 11 19:40:16 2007 Return-Path: X-Original-To: freebsd-i386@hub.freebsd.org Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ECA3416A415 for ; Thu, 11 Jan 2007 19:40:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id B009413C448 for ; Thu, 11 Jan 2007 19:40:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l0BJeFKt019172 for ; Thu, 11 Jan 2007 19:40:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l0BJeFVf019171; Thu, 11 Jan 2007 19:40:15 GMT (envelope-from gnats) Resent-Date: Thu, 11 Jan 2007 19:40:15 GMT Resent-Message-Id: <200701111940.l0BJeFVf019171@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jo Rhett Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0397716A40F for ; Thu, 11 Jan 2007 19:32:32 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id DCD0B13C428 for ; Thu, 11 Jan 2007 19:32:31 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l0BJWVv6047745 for ; Thu, 11 Jan 2007 19:32:31 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l0BJWVBZ047744; Thu, 11 Jan 2007 19:32:31 GMT (envelope-from nobody) Message-Id: <200701111932.l0BJWVBZ047744@www.freebsd.org> Date: Thu, 11 Jan 2007 19:32:31 GMT From: Jo Rhett To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: i386/107829: invalid boundary checking in fdisk / wraps value of > 2TB filesystem. X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2007 19:40:16 -0000 >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: The data for partition 3 is: The data for partition 4 is: 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: