sendfile data corruption (was: cvs commit: src/sys/kern uipc_syscalls.c src/sys/sys libkern.h socket.h)

Joe Marcus Clarke marcus at FreeBSD.org
Fri Nov 10 19:20:52 PST 2006


On Sat, 2006-11-11 at 03:09 +0100, Pawel Worach wrote:
> Andre Oppermann wrote:
> > andre       2006-11-02 16:53:26 UTC
> > 
> >   FreeBSD src repository
> > 
> ...
> >   Rewrite kern_sendfile() to work in two loops, the inner which turns as many
> ...
> >   
> >   Revision  Changes    Path
> >   1.240     +280 -242  src/sys/kern/uipc_syscalls.c
> >   1.55      +2 -0      src/sys/sys/libkern.h
> >   1.91      +2 -1      src/sys/sys/socket.h
> 
> Hi Andre,
> 
> I'm seeing some strange data corruption with this change.
> Using apache 2.0.59 from ports, hardware is SMP i386.
> 
> 0>root at cookie /usr/local/www/data# md5 sh
> MD5 (sh) = e090ae9fc697b6ec84165af920034dc4
> 0>root at cookie /usr/local/www/data# unsetenv http_proxy
> 0>root at cookie /usr/local/www/data# fetch -o /tmp/sh http://127.0.0.1/sh
> /tmp/sh                                       100% of  109 kB 6516 kBps
> 0>root at cookie /usr/local/www/data# md5 /tmp/sh
> MD5 (/tmp/sh) = 1b6b9786ce7aa74b7ecbc7ee82c230dd
> 
> It seems to be consistent...
> 0>root at zero /usr/local/www/data# fetch -o /tmp/sh2 http://127.0.0.1/sh
> /tmp/sh2                                      100% of  109 kB   41 MBps
> 0>root at zero /usr/local/www/data# md5 /tmp/sh2
> MD5 (/tmp/sh2) = 1b6b9786ce7aa74b7ecbc7ee82c230dd
> 
> Checking with hd(1) the changed data always seems to start at offset 
> 0x0000e000.
> 
> cvs up -D '2006/11/02 17:00:00' OK
>     Repository revision: 1.239 
> /export/ctm/cvs/src/sys/kern/uipc_syscalls.c,v
> 
> cvs up -D '2006/11/02 18:00:00' BROKEN
>     Repository revision: 1.240 
> /export/ctm/cvs/src/sys/kern/uipc_syscalls.c,v
> 
> Files changed with update:
> P geom/journal/g_journal.c
> P kern/uipc_syscalls.c
> P sys/libkern.h
> P sys/socket.h
> 
> Any other information I can provide?

Looks to me like there's some unnecessary calculations happening to get
the xfsize.  Does the following patch help?

http://www.marcuscom.com/downloads/uipc_syscalls.c.diff

Joe

-- 
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome at FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20061111/33389225/attachment.pgp


More information about the freebsd-current mailing list