kern/106703: [PATCH] vn_stat() fails with files > 2Gb on msdosfs (non 386)

Axel Gonzalez loox at e-shell.net
Wed Dec 13 22:40:13 PST 2006


>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 at 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:


More information about the freebsd-bugs mailing list