From: Linus Torvalds <torvalds@linux-foundation.org>
To: Bron Gondwana <brong@fastmail.fm>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Nick Piggin <npiggin@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Rob Mueller <robm@fastmail.fm>, Andi Kleen <ak@suse.de>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: BUG: mmapfile/writev spurious zero bytes (x86_64/not i386, bisected, reproducable)
Date: Tue, 17 Jun 2008 13:16:39 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0806171309130.2981@woody.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0806171041560.25099@woody.linux-foundation.org>
On Tue, 17 Jun 2008, Linus Torvalds wrote:
>
> Bron, does this untested patch hide the bug?
Ok, it does hide the bug.
> I don't think this patch is correct, because it doesn't really fix the
> basic issue (the code should do the right thing even if a page isn't
> there), but it might hide it by faulting in the whole "bytes" range rather
> than just the first iov.
>
> So Nick, it's still over to you, but if this does hide it, then that's an
> interesting detail in itself.
I actually am starting to think that the bug is in
__copy_to_user_inatomic_nocache().
The return value of that thing in the case of a failure seems to be
totally wrong. In particular, since that function does an unrolled loop of
accesses like so:
.Ls1: movq (%rsi),%r11
.Ls2: movq 1*8(%rsi),%r8
.Ls3: movq 2*8(%rsi),%r9
.Ls4: movq 3*8(%rsi),%r10
.Ld1: movnti %r11,(%rdi)
.Ld2: movnti %r8,1*8(%rdi)
.Ld3: movnti %r9,2*8(%rdi)
.Ld4: movnti %r10,3*8(%rdi)
it may have done three of the 64-bit loads, and then trap on the fouth:
but since it hasn't done a _single_ of the stores, it shouldn't count as
any different whether it traps on any of .Ls[1-4]. But that code
definitely seems to think it makes a difference whether the exception
happened at Ls1 or at Ls4, even though both points have copied _exactly_
as many bytes when the exception happens.
So I'm starting to think the bug is all in there, not in the VM itself.
See arch/x86/lib/copy_user_nocache.S.
In fact, even the comment there implies that the author didn't know or
care about returning the correct value.
Andi and Ingo added to Cc.
Linus
next prev parent reply other threads:[~2008-06-17 20:17 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 6:00 Bron Gondwana
2008-06-17 6:02 ` Bron Gondwana
2008-06-17 17:08 ` Linus Torvalds
2008-06-17 17:45 ` Linus Torvalds
2008-06-17 20:16 ` Linus Torvalds [this message]
2008-06-17 20:41 ` Linus Torvalds
2008-06-17 21:06 ` Linus Torvalds
2008-06-17 21:16 ` Andi Kleen
2008-06-17 21:24 ` Linus Torvalds
2008-06-17 21:30 ` Andi Kleen
2008-06-17 21:37 ` Linus Torvalds
2008-06-17 21:36 ` Al Viro
2008-06-17 21:42 ` Andi Kleen
2008-06-17 21:49 ` Linus Torvalds
2008-06-17 22:11 ` Al Viro
2008-06-17 22:21 ` Andi Kleen
2008-06-18 6:22 ` Nick Piggin
2008-06-17 21:20 ` Linus Torvalds
2008-06-18 2:27 ` Bron Gondwana
2008-06-18 3:14 ` Bron Gondwana
2008-06-18 4:03 ` Linus Torvalds
2008-06-18 5:11 ` Cyrus mmap vs lseek/write usage - (WAS: BUG: mmapfile/writev spurious zero bytes (x86_64/not i386, bisected, reproducable)) Bron Gondwana
2008-06-18 16:22 ` Linus Torvalds
2008-06-18 23:45 ` Robert Mueller
2008-06-19 0:20 ` Linus Torvalds
2008-10-03 11:44 ` BUG: mmapfile/writev spurious zero bytes still in the wild Bron Gondwana
2008-10-03 13:07 ` Andrew Morton
2008-10-04 0:13 ` Bron Gondwana
2008-06-17 21:15 ` BUG: mmapfile/writev spurious zero bytes (x86_64/not i386, bisected, reproducable) Andi Kleen
2008-06-17 20:58 ` Andi Kleen
2008-06-17 21:14 ` Linus Torvalds
2008-06-17 21:26 ` Andi Kleen
2008-06-17 21:31 ` Linus Torvalds
2008-06-17 21:34 ` Linus Torvalds
2008-06-17 21:34 ` Andi Kleen
2008-06-17 21:46 ` Linus Torvalds
2008-06-18 6:10 ` Nick Piggin
2008-06-18 2:21 ` Bron Gondwana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.10.0806171309130.2981@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=brong@fastmail.fm \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=npiggin@suse.de \
--cc=robm@fastmail.fm \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®