Date: Fri, 26 Apr 2019 10:35:08 +0200 From: Hans Petter Selasky <hps@selasky.org> To: Alan Somers <asomers@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: buf(9) woes: when does bcopy do nothing at all? Message-ID: <4af9e5dd-8346-69b5-f999-57821d846b94@selasky.org> In-Reply-To: <CAOtMX2gdw%2BeQQU_-DC%2BEgimbCyw6ynbX1haGLUmn1dApk4rMZw@mail.gmail.com> References: <CAOtMX2gdw%2BeQQU_-DC%2BEgimbCyw6ynbX1haGLUmn1dApk4rMZw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 4/26/19 5:31 AM, Alan Somers wrote: > How is it possible that bcopy() doesn't affect its output array at > all? While investigating a data corruption issue in fuse, I narrowed > the problem down to a bcopy operation that apparently has no affect. > The code in question is: > Hi, Can you show the whole code? Which architecture is this? Can you also print all arguments when this happens? --HPS > bcopy(cp, iov->iov_base, cnt); > r = memcmp(cp, iov->iov_base, cnt); > if (r) > printf("uiomove: miscompare\n"); > > Rationally, I would expect that line never to be printed. But it > does. The destination is always all zeros, even though the source is > not. I can only guess that there's something wrong about the way that > I I'm using buf(9), because the output is part of a buffer allocated > by bread(9). I've been able to rule out: > > 1) Race conditions. The bug is 100% reproducible, and doubling the > bcopy or changing the timing in other ways has no effect. > 2) Unmapped buffer. I verified that the buf is not unmapped_buf. > 3) Overlapping src and dst > 4) Duplicated pages. I verified that each of the buf's pages has a > unique physical address > 5) Bad RAM. My machine passes memtest86, and anyway the failure is > too specific and reproducible to be caused by bad hardware. > > What could I be missing? Do I need to do something to prepare the buf > before I can use it? The code that allocates the buffer is here: > https://svnweb.freebsd.org/base/projects/fuse2/sys/fs/fuse/fuse_io.c?view=markup#l240 > > -Alan > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4af9e5dd-8346-69b5-f999-57821d846b94>