Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756541AbZCFWzq (ORCPT ); Fri, 6 Mar 2009 17:55:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753346AbZCFWzi (ORCPT ); Fri, 6 Mar 2009 17:55:38 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:40087 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752999AbZCFWzh (ORCPT ); Fri, 6 Mar 2009 17:55:37 -0500 Date: Fri, 6 Mar 2009 22:55:25 +0000 From: Russell King - ARM Linux To: Steven Walter Cc: linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org Subject: Re: cache aliasing in dup_mmap Message-ID: <20090306225525.GB3212@n2100.arm.linux.org.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1336 Lines: 35 On Fri, Mar 06, 2009 at 05:26:24PM -0500, Steven Walter wrote: > I've been tracking down an instance of userspace data corruption, and I > believe I have found a window during fork where data can be lost. The > corruption is occurring on an ARMv5 system with VIVT caches. Here's the > scenario in question. Thread A is forking, Thread B is running in > userspace: With VIVT caches, you're missing a few things here: > Thread A: flush_cache_mm (dup_mmap) -- cache written back and invalidated > Thread B: writes to a page in the above mm -- cache written back and invalidated > Thread A: pte_wrprotect the above page (copy_one_pte) -- cache written back and invalidated > Thread B: writes to the same page again > > During thread B's second write, he'll take a fault and enter the do_wp_page > case. We'll end up calling copy_page, which notably uses the kernel virtual > addresses for the old and new pages. This means that the new page does not > necessarily have the data from the first write. Given the additional flushing I've mentioned above, where could the problem be? -- 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/