From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753435AbdJGCb5 (ORCPT ); Fri, 6 Oct 2017 22:31:57 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:41000 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753160AbdJGCbz (ORCPT ); Fri, 6 Oct 2017 22:31:55 -0400 Date: Sat, 7 Oct 2017 03:31:52 +0100 From: Al Viro To: Jia-Ju Bai Cc: bcrl@kvack.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [BUG] fs/aio: A possible sleep-in-atomic bug in aio_migratepage Message-ID: <20171007023152.GQ21978@ZenIV.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.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 07, 2017 at 09:36:48AM +0800, Jia-Ju Bai wrote: > According to fs/aio.c, cond_resched is called under a spinlock, > and the function call path is: > aio_migratepage (acquire the spinlock) > migrate_page_copy > copy_huge_page > __copy_gigantic_page > cond_resched > might_sleep > > This bug is found by my static analysis tool and my code review. > A possible fix is to remove cond_resched in __copy_gigantic_page. How the hell would a huge page end up in page cache of inode created by aio_private_file()???