From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 14 06:40:13 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BFB516A417 for ; Thu, 14 Dec 2006 06:40:13 +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 63B1243CAE for ; Thu, 14 Dec 2006 06:38:39 +0000 (GMT) (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 kBE6eCLg027526 for ; Thu, 14 Dec 2006 06:40:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kBE6eChb027523; Thu, 14 Dec 2006 06:40:12 GMT (envelope-from gnats) Resent-Date: Thu, 14 Dec 2006 06:40:12 GMT Resent-Message-Id: <200612140640.kBE6eChb027523@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Axel Gonzalez Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4284816A407 for ; Thu, 14 Dec 2006 06:30:16 +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 A2F7343CA1 for ; Thu, 14 Dec 2006 06:28:42 +0000 (GMT) (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 kBE6UFEN020980 for ; Thu, 14 Dec 2006 06:30:15 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id kBE6UFU2020979; Thu, 14 Dec 2006 06:30:15 GMT (envelope-from nobody) Message-Id: <200612140630.kBE6UFU2020979@www.freebsd.org> Date: Thu, 14 Dec 2006 06:30:15 GMT From: Axel Gonzalez To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: kern/106703: [PATCH] vn_stat() fails with files > 2Gb on msdosfs (non 386) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2006 06:40:13 -0000 >Number: 106703 >Category: kern >Synopsis: [PATCH] vn_stat() fails with files > 2Gb on msdosfs (non 386) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 14 06:40:12 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Axel Gonzalez >Release: 6.2-PRERELEASE >Organization: >Environment: FreeBSD moonlight 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #4: Wed Dec 13 23:29:13 CST 2006 loox@moonlight:/usr/obj/usr/src/sys/LXAMD64 amd64 >Description: When you copy/create a file > 2Gb on a msdosfs, it is created correctly, but vn_stat() fails on the file. Since the function is used on several userland programs (ls, rm), it seems like the file is not on the FS. $ ls ls: DVD.iso: Value too large to be stored in data type. This is caused by an uncasted macro, instead of reporting the corrected size, it reports a negative one (or a very large one) This problem is only on non-386 systems (which use alternate macro) >How-To-Repeat: Copy (create) a file > 2Gb on a msdosfs try to ls (rm, stat, etc) $ cp /ufs_disk/DVD.iso /msdosfs_disk $ ls ls: DVD.iso: Value too large to be stored in data type >Fix: Apply the attached patch, recompile sys_fs_msdosfs_bpb.h.patch Patch attached with submission follows: --- bpb.h.orig Wed Dec 13 22:58:50 2006 +++ bpb.h Wed Dec 13 22:59:39 2006 @@ -105,7 +105,8 @@ #define putulong(p, v) (*((u_int32_t *)(p)) = (v)) #else #define getushort(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8)) -#define getulong(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8) \ +#define getulong(x) (u_int32_t)(((u_int8_t *)(x))[0] \ + + (((u_int8_t *)(x))[1] << 8) \ + (((u_int8_t *)(x))[2] << 16) \ + (((u_int8_t *)(x))[3] << 24)) #define putushort(p, v) (((u_int8_t *)(p))[0] = (v), \ >Release-Note: >Audit-Trail: >Unformatted: