From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756965AbcIGMkv (ORCPT ); Wed, 7 Sep 2016 08:40:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35224 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756556AbcIGMkt (ORCPT ); Wed, 7 Sep 2016 08:40:49 -0400 Date: Wed, 7 Sep 2016 14:40:46 +0200 From: Andrea Arcangeli To: "Kirill A. Shutemov" Cc: Dmitry Vyukov , Ebru Akagunduz , Andrew Morton , Vlastimil Babka , Mel Gorman , Johannes Weiner , "linux-mm@kvack.org" , LKML , Vegard Nossum , Sasha Levin , Konstantin Khlebnikov , Andrey Ryabinin , Greg Thelen , Suleiman Souhlal , Hugh Dickins , David Rientjes , syzkaller , Kostya Serebryany , Alexander Potapenko Subject: Re: mm: use-after-free in collapse_huge_page Message-ID: <20160907124046.o2tmoedx4j3jyux5@redhat.com> References: <20160829124233.GA40092@black.fi.intel.com> <20160829153548.pmwcup4q74hafwmu@redhat.com> <20160907122559.GA6542@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160907122559.GA6542@black.fi.intel.com> User-Agent: Mutt/1.6.2 (2016-06-11) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 07 Sep 2016 12:40:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 07, 2016 at 03:25:59PM +0300, Kirill A. Shutemov wrote: > Here's updated version. > > From 14d748bd8a7eb003efc10b1e5d5b8a644e7181b1 Mon Sep 17 00:00:00 2001 > From: "Kirill A. Shutemov" > Date: Mon, 29 Aug 2016 15:32:50 +0300 > Subject: [PATCH] khugepaged: fix use-after-free in collapse_huge_page() > > hugepage_vma_revalidate() tries to re-check if we still should try to > collapse small pages into huge one after the re-acquiring mmap_sem. > > The problem Dmitry Vyukov reported[1] is that the vma found by > hugepage_vma_revalidate() can be suitable for huge pages, but not the > same vma we had before dropping mmap_sem. And dereferencing original vma > can lead to fun results.. > > Let's use vma hugepage_vma_revalidate() found instead of assuming it's > the same as what we had before the lock was dropped. > > [1] http://lkml.kernel.org/r/CACT4Y+Z3gigBvhca9kRJFcjX0G70V_nRhbwKBU+yGoESBDKi9Q@mail.gmail.com > > Signed-off-by: Kirill A. Shutemov > Reported-by: Dmitry Vyukov > --- > mm/khugepaged.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) Reviewed-by: Andrea Arcangeli