From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: Corruption with O_DIRECT and unaligned user buffers Date: Wed, 19 Nov 2008 17:58:19 +0100 Message-ID: <20081119165819.GE19209@random.random> References: <491DAF8E.4080506@quantum.com> <200811191526.00036.nickpiggin@yahoo.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Tim LaBerge , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org To: Nick Piggin Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33796 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbYKSQ62 (ORCPT ); Wed, 19 Nov 2008 11:58:28 -0500 Content-Disposition: inline In-Reply-To: <200811191526.00036.nickpiggin@yahoo.com.au> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Nov 19, 2008 at 03:25:59PM +1100, Nick Piggin wrote: > The solution either involves synchronising forks and get_user_pages, > or probably better, to do copy on fork rather than COW in the case > that we detect a page is subject to get_user_pages. The trick is in > the details :) We already have a patch that works. The only trouble here is get_user_pages_fast, it breaks the fix for fork, the current ksm (that is safe against get_user_pages but can't be safe against get_user_pages_fast) and even migrate.c memory-corrupts against O_DIRECT after the introduction of get_user_pages_fast. So I recommend focusing on how to fix get_user_pages_fast for any of the 3 broken pieces, then hopefully the same fix will work for the other two. fork is special in that it even breaks against get_user_pages but again we've a fix for that. The only problem without a solution is how to serialize against get_user_pages_fast. A brlock was my proposal, not nice but still better than backing out get_user_pages_fast.