From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbdKAKRs (ORCPT ); Wed, 1 Nov 2017 06:17:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752141AbdKAKRr (ORCPT ); Wed, 1 Nov 2017 06:17:47 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A7A85356D3 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=aarcange@redhat.com Date: Wed, 1 Nov 2017 11:17:44 +0100 From: Andrea Arcangeli To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Dmitry Vyukov , syzbot , Jan Beulich , "H. Peter Anvin" , Josh Poimboeuf , "Kirill A. Shutemov" , ldufour@linux.vnet.ibm.com, LKML , Andy Lutomirski , Ingo Molnar , syzkaller-bugs@googlegroups.com, Thomas Gleixner , the arch/x86 maintainers , Andrew Morton , Michal Hocko , Hugh Dickins , David Rientjes , linux-mm@kvack.org, Linus Torvalds , Thorsten Leemhuis Subject: Re: KASAN: use-after-free Read in __do_page_fault Message-ID: <20171101101744.GA1846@redhat.com> References: <94eb2c0433c8f42cac055cc86991@google.com> <8e92c891-a9e0-efed-f0b9-9bf567d8fbcd@suse.cz> <4bc852be-7ef3-0b60-6dbb-81139d25a817@suse.cz> <20171031141152.tzx47fy26pvx7xug@node.shutemov.name> <20171031191506.GB2799@redhat.com> <94aa563c-14da-7892-51a0-e1799cdad050@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94aa563c-14da-7892-51a0-e1799cdad050@suse.cz> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 01 Nov 2017 10:17:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 01, 2017 at 08:42:57AM +0100, Vlastimil Babka wrote: > The vma should be pinned by mmap_sem, but handle_userfault() will in some > scenarios release it and then acquire again, so when we return to In the above message and especially in the below comment, I would suggest to take the opportunity to more accurately document the specific scenario instead of "some scenario" which is only "A return to userland to repeat the page fault later with a VM_FAULT_NOPAGE retval (potentially after handling any pending signal during the return to userland). The return to userland is identified whenever FAULT_FLAG_USER|FAULT_FLAG_KILLABLE are both set in vmf->flags". > + * in some scenario (and not return VM_FAULT_RETRY), we have to be Thanks, Andrea