From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 29 Sep 2007 08:37:17 +0200 From: Jens Axboe Subject: Re: [patch] splice mmap_sem deadlock Message-ID: <20070929063715.GD11717@kernel.dk> References: <20070928160035.GD12538@wotan.suse.de> <20070928173144.GA11717@kernel.dk> <20070928181513.GB11717@kernel.dk> <20070928193017.GC11717@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org Return-Path: To: Linus Torvalds Cc: Nick Piggin , Andrew Morton , Linux Memory Management List List-ID: On Fri, Sep 28 2007, Linus Torvalds wrote: > > > On Fri, 28 Sep 2007, Linus Torvalds wrote: > > > > So something like the appended might work. Untested. > > Btw, it migth be cleaner to separate out this thing as a function of it's > own, ie something like > > /* > * Do a copy-from-user while holding the mmap_semaphore for reading > */ > int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n) > { > int partial; > > pagefault_disable(); > partial = __copy_from_user_inatomic(dst, src, n); > pagefault_enable(); > > if (!partial) > return 0; > up_read(¤t->mm->mmap_sem); > partial = copy_from_user(dst, src, n); > down_read(¤t->mm->mmap_sem); > > return partial ? -EFAULT : 0; > } > > in case anybody else needs it. And even if nobody else does, making it a > static inline function in fs/splice.c would at least separate out this > thing from the core functionality, and just help keep things clear. > > Wanna test that thing? Sure thing, I like this approach a lot more! I'll whip up a combo of this and the previous and give it some testing. Don't expect a tested patch before monday though, weekend fully booked... -- Jens Axboe -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org