Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933149AbdC2VRU (ORCPT ); Wed, 29 Mar 2017 17:17:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57830 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932906AbdC2VRS (ORCPT ); Wed, 29 Mar 2017 17:17:18 -0400 Date: Wed, 29 Mar 2017 14:17:11 -0700 From: Andrew Morton To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dmitry Vyukov , Hillf Danton , Michal Hocko , "Kirill A . Shutemov" , Andrey Ryabinin , Naoya Horiguchi Subject: Re: [PATCH RESEND] mm/hugetlb: Don't call region_abort if region_chg fails Message-Id: <20170329141711.50c183a7bb1bfa75e24d4426@linux-foundation.org> In-Reply-To: <1490821682-23228-1-git-send-email-mike.kravetz@oracle.com> References: <1490821682-23228-1-git-send-email-mike.kravetz@oracle.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1594 Lines: 38 On Wed, 29 Mar 2017 14:08:02 -0700 Mike Kravetz wrote: > Resending because of typo in Andrew's e-mail when first sent > > Changes to hugetlbfs reservation maps is a two step process. The first > step is a call to region_chg to determine what needs to be changed, and > prepare that change. This should be followed by a call to call to > region_add to commit the change, or region_abort to abort the change. > > The error path in hugetlb_reserve_pages called region_abort after a > failed call to region_chg. As a result, the adds_in_progress counter > in the reservation map is off by 1. This is caught by a VM_BUG_ON > in resv_map_release when the reservation map is freed. > > syzkaller fuzzer found this bug, that resulted in the following: I'll change the above to : syzkaller fuzzer (when using an injected kmalloc failure) found this bug, : that resulted in the following: it's important, because this bug won't be triggered (at all easily, at least) in real-world workloads. > kernel BUG at mm/hugetlb.c:742! > Call Trace: > hugetlbfs_evict_inode+0x7b/0xa0 fs/hugetlbfs/inode.c:493 > evict+0x481/0x920 fs/inode.c:553 > iput_final fs/inode.c:1515 [inline] > iput+0x62b/0xa20 fs/inode.c:1542 > hugetlb_file_setup+0x593/0x9f0 fs/hugetlbfs/inode.c:1306 > newseg+0x422/0xd30 ipc/shm.c:575 > ipcget_new ipc/util.c:285 [inline] > ipcget+0x21e/0x580 ipc/util.c:639 > SYSC_shmget ipc/shm.c:673 [inline] > SyS_shmget+0x158/0x230 ipc/shm.c:657 > entry_SYSCALL_64_fastpath+0x1f/0xc2 > RIP: resv_map_release+0x265/0x330 mm/hugetlb.c:742