From: "Li Xinhai" <lixinhai.lxh@gmail.com>
To: linux-mm <linux-mm@kvack.org>, akpm <akpm@linux-foundation.org>,
torvalds <torvalds@linux-foundation.org>
Cc: "Vlastimil Babka" <vbabka@suse.cz>,
yang.shi <yang.shi@linux.alibaba.com>,
"Linux API" <linux-api@vger.kernel.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Hugh Dickins" <hughd@google.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
lixinhai_lxh <lixinhai_lxh@126.com>
Subject: mbind() breaks its API definition since v5.2 by commit d883544515aa (mm: mempolicy: make the behavior consistent when MPOL_MF_MOVE* and MPOL_MF_STRICT were specified)
Date: Wed, 30 Oct 2019 10:27:48 +0800 [thread overview]
Message-ID: <2019103010274679257634@gmail.com> (raw)
One change in do_mbind() of this commit has suspicious usage of return value of
queue_pages_range(), excerpt as below:
---
@@ -1243,10 +1265,15 @@ static long do_mbind(unsigned long start, unsigned long len,
if (err)
goto mpol_out;
- err = queue_pages_range(mm, start, end, nmask,
+ ret = queue_pages_range(mm, start, end, nmask,
flags | MPOL_MF_INVERT, &pagelist);
- if (!err)
- err = mbind_range(mm, start, end, new);
+
+ if (ret < 0) { /////// convert to all possible 'ret' to '-EIO' <<<<
+ err = -EIO;
+ goto up_out;
+ }
+
+ err = mbind_range(mm, start, end, new);
if (!err) {
int nr_failed = 0;
---
Note that inside queue_pages_range(), the call to walk_page_range() may return
errors from 'test_walk' of 'struct mm_walk_ops', e.g. -EFAULT. Now, those error
codes are no longer reported to user space application.
From user space, the mbind() call need to reported error, with EFAULT, as example:
EFAULT
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.
Please correct me if this is the intended change(and will have updated API
definition), or something was misunderstood.
-Xinhai
next reply other threads:[~2019-10-30 2:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 2:27 Li Xinhai [this message]
2019-10-30 2:50 ` Yang Shi
2019-10-30 3:12 ` Li Xinhai
2019-10-30 4:32 ` Yang Shi
2019-10-30 5:59 ` Li Xinhai
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=2019103010274679257634@gmail.com \
--to=lixinhai.lxh@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lixinhai_lxh@126.com \
--cc=mhocko@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
--cc=yang.shi@linux.alibaba.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