linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Dmitry Vyukov <dvyukov@google.com>,
	nyc@holomorphy.com, Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>
Subject: Re: mm: BUG in resv_map_release
Date: Thu, 23 Mar 2017 11:02:22 -0700	[thread overview]
Message-ID: <888af92c-1d20-d9f4-a425-c720d1179756@oracle.com> (raw)
In-Reply-To: <a10eb28c-305d-3547-8df1-7a2216473e09@oracle.com>

On 03/23/2017 10:25 AM, Mike Kravetz wrote:
> On 03/23/2017 03:19 AM, Dmitry Vyukov wrote:
>> Hello,
>>
>> I've got the following BUG while running syzkaller fuzzer.
>> Note the injected kmalloc failure, most likely it's the root cause.
> 
> Thanks  Dmitry,
> 
> The BUG indicates someone called region_chg() in the process of adding
> a hugetlbfs page reservation, but did not complete this 'two step'
> process with a call to region_add() or region_abort().  Most likely a
> missed call in an error path somewhere.  :(
> 
> I'll try to track this down.  The hint of 'injected kmalloc failure'
> should help.

Actually, in this case I believe the bug is in hugetlb_reserve_pages.
It calls region_chg(), but gets an error due to the injected kmalloc
failure.  At this point, the resv_map->adds_in_progress is 0 as it
should be.  However, the error path for hugetlb_reserve_pages calls
region_abort() which will unconditionally decrement adds_in_progress.
So, adds_in_progress goes negative and we eventually BUG.  :(

I'll look for other misuses of region_chg()/region_add()/region_abort()
and put together a patch.

Dmitry, is there some way to run the fuzzer with kmalloc failure injection
and target the hugetlbfs code?  I'm suspect we could flush out other bugs.
I noticed one other you discovered, and will look at that next.

-- 
Mike Kravetz

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-03-23 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 10:19 mm: BUG in resv_map_release Dmitry Vyukov
2017-03-23 10:20 ` Dmitry Vyukov
2017-03-23 17:25 ` Mike Kravetz
2017-03-23 18:02   ` Mike Kravetz [this message]
2017-03-24  8:56     ` Dmitry Vyukov
2017-03-28 23:38 ` Andrew Morton
2017-03-29  0:07   ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=888af92c-1d20-d9f4-a425-c720d1179756@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=nyc@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).