linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	dan.carpenter@oracle.com
Subject: Re: mm: kernel BUG at mm/mempolicy.c:1203!
Date: Tue, 17 Dec 2013 12:38:49 +0800	[thread overview]
Message-ID: <52AFD559.5010405@oracle.com> (raw)
In-Reply-To: <52AFA46A.2040605@oracle.com>

On 12/17/2013 09:10 AM, Sasha Levin wrote:
> On 12/16/2013 07:44 PM, Bob Liu wrote:
>>
>> On 12/16/2013 07:37 AM, Sasha Levin wrote:
>>> Hi all,
>>>
>>> While fuzzing with trinity inside a KVM tools guest running latest -next
>>> kernel, I've
>>> stumbled on the following spew.
>>>
>>> This seems to be due to commit 0bf598d863e "mbind: add BUG_ON(!vma) in
>>> new_vma_page()"
>>> which added that BUG_ON.
>>
>> Could you take a try with this patch from Wanpeng Li?
>>
>> Thanks,
>> -Bob
>>
>> Subject: [PATCH] mm/mempolicy: fix !vma in new_vma_page()
>> ....
>> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>> index eca4a31..73b5a35 100644
>> --- a/mm/mempolicy.c
>> +++ b/mm/mempolicy.c
>> @@ -1197,14 +1197,16 @@ static struct page *new_vma_page(struct page
>> *page, unsigned long private, int *
>>               break;
>>           vma = vma->vm_next;
>>       }
>> +
>> +    if (PageHuge(page)) {
>> +        if (vma)
>> +            return alloc_huge_page_noerr(vma, address, 1);
>> +        else
>> +            return NULL;
>> +    }
>>       /*
>> -     * queue_pages_range() confirms that @page belongs to some vma,
>> -     * so vma shouldn't be NULL.
>> +     * if !vma, alloc_page_vma() will use task or system default policy
>>        */
>> -    BUG_ON(!vma);
>> -
>> -    if (PageHuge(page))
>> -        return alloc_huge_page_noerr(vma, address, 1);
>>       return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
>>   }
>>   #else
>>
> 
> Hmm... So in essence it's mostly a revert of Naoya's patch, who seemed
> pretty certain that this
> situation shouldn't happen at all. What's the reasoning behind just

I think this assumption may not correct.
Even if
address = __vma_address(page, vma);
and
vma->start < address < vma->end;
page_address_in_vma() may still return -EFAULT because of many other
conditions in it.
As a result the while loop in new_vma_page() may end with vma=NULL.

Naoya, any idea?

-- 
Regards,
-Bob

--
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:[~2013-12-17  4:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-15 23:37 mm: kernel BUG at mm/mempolicy.c:1203! Sasha Levin
2013-12-16  0:26 ` Andrew Morton
2013-12-17  0:44 ` Bob Liu
2013-12-17  1:10   ` Sasha Levin
2013-12-17  4:38     ` Bob Liu [this message]
2013-12-17  6:11       ` Naoya Horiguchi
2013-12-17  6:23         ` Wanpeng Li
2013-12-17  6:46         ` Sasha Levin
2013-12-17  6:55           ` Wanpeng Li
     [not found]           ` <20131217065518.GA29118@hacker.(null)>
2013-12-17  6:57             ` Sasha Levin

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=52AFD559.5010405@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=sasha.levin@oracle.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).