From nobody@FreeBSD.org  Tue Jun 15 18:05:41 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4E7B816A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 15 Jun 2004 18:05:41 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 497B543D5E
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 15 Jun 2004 18:05:41 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i5FI4p5o015760
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 15 Jun 2004 18:04:51 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i5FI4paE015759;
	Tue, 15 Jun 2004 18:04:51 GMT
	(envelope-from nobody)
Message-Id: <200406151804.i5FI4paE015759@www.freebsd.org>
Date: Tue, 15 Jun 2004 18:04:51 GMT
From: Klaus Steden <klaus@compt.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: integer overflow in statfs structure
X-Send-Pr-Version: www-2.3

>Number:         67982
>Category:       bin
>Synopsis:       integer overflow in statfs structure
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 15 18:10:16 GMT 2004
>Closed-Date:    Sat Jun 19 22:22:26 GMT 2004
>Last-Modified:  Sat Jun 19 22:22:26 GMT 2004
>Originator:     Klaus Steden
>Release:        4.9-STABLE
>Organization:
>Environment:
FreeBSD kubrick.compt.com 4.9-STABLE FreeBSD 4.9-STABLE #0: Tue Nov 25 18:16:15 EST 2003     klaus@kubrick.compt.com:/usr/obj/usr/src/sys/Manhattan  i386

>Description:
One of my NFS-mounted volumes is quite large (about 1.1 TB, or 2291609600 blocks to be precise); df incorrectly reports the size as a negative value:

@kubrick:~[285]$ df -h /helios
Filesystem      Size   Used  Avail Capacity  Mounted on
atlas:/helios -955.3G   840G   252G   -88%    /helios

I compiled df from source with debugging symbols and ran it through gdb, and it appears that the f_blocks member in the statfs structure used by statfs() is simply not big enough to hold the value returned.
>How-To-Repeat:
Can be repeated by using df, and presumably also by any program that uses a statfs structure on a large filesystem.
>Fix:
Increase the size of the f_blocks parameter (and possibly others) to something larger.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: das 
State-Changed-When: Sat Jun 19 22:22:02 GMT 2004 
State-Changed-Why:  
Changing struct statfs would cause ABI breakage, so it is unlikely to 
ever happen in 4.X.  The change you suggest was made in 5.X a long 
time ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=67982 
>Unformatted:
