From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752854AbdJGBhA (ORCPT ); Fri, 6 Oct 2017 21:37:00 -0400 Received: from m12-12.163.com ([220.181.12.12]:34825 "EHLO m12-12.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbdJGBg6 (ORCPT ); Fri, 6 Oct 2017 21:36:58 -0400 From: Jia-Ju Bai Subject: [BUG] fs/aio: A possible sleep-in-atomic bug in aio_migratepage To: bcrl@kvack.org, Al Viro Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: Date: Sat, 7 Oct 2017 09:36:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-CM-TRANSID: DMCowACnw+GyL9hZ_uFfIQ--.28530S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUyZa9DUUUU X-Originating-IP: [183.172.144.119] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiVhJqelWBaKXsdAAAsV Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Jia-Ju Bai