Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758137AbYFQVPP (ORCPT ); Tue, 17 Jun 2008 17:15:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755407AbYFQVPB (ORCPT ); Tue, 17 Jun 2008 17:15:01 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:39549 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755012AbYFQVPA (ORCPT ); Tue, 17 Jun 2008 17:15:00 -0400 Date: Tue, 17 Jun 2008 14:14:40 -0700 (PDT) From: Linus Torvalds To: Andi Kleen cc: Bron Gondwana , Linux Kernel Mailing List , Nick Piggin , Andrew Morton , Rob Mueller , Ingo Molnar Subject: Re: BUG: mmapfile/writev spurious zero bytes (x86_64/not i386, bisected, reproducable) In-Reply-To: <87od5zwzh2.fsf@basil.nowhere.org> Message-ID: References: <1213682410.13174.1258837181@webmail.messagingengine.com> <1213682570.13708.1258839317@webmail.messagingengine.com> <87od5zwzh2.fsf@basil.nowhere.org> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 916 Lines: 27 On Tue, 17 Jun 2008, Andi Kleen wrote: > > The x86-64 copy_*_user functions were always designed to return errors > both ways (as in both for load and for store). That's not the problem, Andi. The problem is that it returns THE WRONG VALUE! If the fault happened on the second load, but the first load was never actually paired up with a store (because of unrolling the loop), then YOU MUST NOT CLAIM THAT YOU DID A 8-BYTE COPY! Because you have copied exactly _zero_ bytes, even though you _loaded_ 8 bytes successfully! See? Claiming that you copied 8 bytes when you didn't do anything at all is WRONG. It's so incredibly wrong that it is scary. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/