kern/92040: mmap/cp fails on small file in UDF

Nate Eldredge nge at cs.hmc.edu
Thu Jan 19 22:40:05 PST 2006


>Number:         92040
>Category:       kern
>Synopsis:       mmap/cp fails on small file in UDF
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 20 06:40:04 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Nate Eldredge
>Release:        FreeBSD 6.0-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD vulcan.lan 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Dec 14 20:08:57 PST 2005 nate at vulcan.lan:/usr/obj/usr/src/sys/VULCAN amd64



>Description:
If you try to copy a small file from a UDF filesystem, cp fails with EINVAL.

The underlying cause is that cp attempts to copy small files using mmap,
and mmap fails in this case.  I don't know whether cp is calling it wrong,
or mmap is simply unimplemented for udf, or if there is some other reason
for the failure.

In any case, it is probably a good idea for cp to fall back to read() if
mmap doesn't work.  It might also be useful to be able to explicitly
tell it to use read().  For example, I don't know what the mmap approach
will do in the presence of I/O errors.  I'm worried that it might silently
make a corrupt copy of the file.

This is on amd64.

Perhaps this bug should be cross-filed in category bin, if that is possible.
I don't know how to do that.

>How-To-Repeat:
nate at vulcan:~/bugs/udf$ mkdir dir
nate at vulcan:~/bugs/udf$ cat >dir/hello
hello world
nate at vulcan:~/bugs/udf$ mkisofs -o img -udf dir/
...
vulcan#	mdconfig -a -t vnode -f img
md0
vulcan#	mount_udf /dev/md0 /mnt/md0
vulcan#	ls -l /mnt/md0
total 0
-r--r--r--  1 root  wheel  12 Jan 20 22:10 hello
vulcan#	cat /mnt/md0/hello
hello world
vulcan#	cp /mnt/md0/hello .
cp: /mnt/md0/hello: Invalid argument

Script done on Thu Jan 19 22:11:55 2006
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list