linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <yang.shi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: lixinhai.lxh@gmail.com, vbabka@suse.cz, mhocko@suse.com,
	mgorman@techsingularity.net, stable@vger.kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: mempolicy: fix the wrong return value and potential pages leak of mbind
Date: Thu, 31 Oct 2019 08:47:17 -0700	[thread overview]
Message-ID: <5cc16fd6-dd63-6798-4e3e-5c3a6b731aa2@linux.alibaba.com> (raw)
In-Reply-To: <20191030213144.dd7cd8084d4171e29abba875@linux-foundation.org>



On 10/30/19 9:31 PM, Andrew Morton wrote:
> On Wed, 30 Oct 2019 11:14:58 -0700 Yang Shi <yang.shi@linux.alibaba.com> wrote:
>
>> On 10/30/19 9:58 AM, Yang Shi wrote:
>>> The commit d883544515aa ("mm: mempolicy: make the behavior consistent
>>> when MPOL_MF_MOVE* and MPOL_MF_STRICT were specified") fixed the return
>>> value of mbind() for a couple of corner cases.  But, it altered the
>>> errno for some other cases, for example, mbind() should return -EFAULT
>>> when part or all of the memory range specified by nodemask and maxnode
>>> points  outside your accessible address space, or there was an unmapped
>>> hole in the specified memory range specified by addr and len.
>>>
>>> Fixed this by preserving the errno returned by queue_pages_range().
>>> And, the pagelist may be not empty even though queue_pages_range()
>>> returns error, put the pages back to LRU since mbind_range() is not called
>>> to really apply the policy so those pages should not be migrated, this
>>> is also the old behavior before the problematic commit.
>> Forgot fixes tag.
>>
>> Fixes: d883544515aa ("mm: mempolicy: make the behavior consistent when
>> MPOL_MF_MOVE* and MPOL_MF_STRICT were specified")
> What's the relationship between this patch and
> http://lkml.kernel.org/r/201910291756045288126@gmail.com?

They are irrelevant. The commit d883544515aa ("mm: mempolicy: make the 
behavior consistent
when MPOL_MF_MOVE* and MPOL_MF_STRICT were specified") override the 
-EFAULT return value of queue_pages_range() by -EIO mistakenly and 
missed putting non-empty pagelist back, this patch is aimed to fix the 
two issues.

I think Li Xinhai found the return value override problem during 
debugging his patch.




      parent reply	other threads:[~2019-10-31 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 16:58 Yang Shi
2019-10-30 18:14 ` Yang Shi
2019-10-31  1:53   ` Li Xinhai
2019-10-31  4:31   ` Andrew Morton
2019-10-31  5:28     ` Li Xinhai
2019-10-31 15:47     ` Yang Shi [this message]

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=5cc16fd6-dd63-6798-4e3e-5c3a6b731aa2@linux.alibaba.com \
    --to=yang.shi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lixinhai.lxh@gmail.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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