From: "lixinhai.lxh@gmail.com" <lixinhai.lxh@gmail.com>
To: mhocko <mhocko@suse.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
akpm <akpm@linux-foundation.org>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Hugh Dickins" <hughd@google.com>
Subject: Re: [PATCH] mm: mempolicy: Fix wrong use of maxnode in mempolicy API
Date: Sat, 9 Nov 2019 00:48:01 +0800 [thread overview]
Message-ID: <2019110900475976433214@gmail.com> (raw)
In-Reply-To: <20191108160456.GN15658@dhcp22.suse.cz>
On 2019-11-09 at 00:04 Michal Hocko wrote:
>On Fri 08-11-19 23:49:29, Li Xinhai wrote:
>> The maxnode used by mbind(), set_mempolicy() and migrate_pages() is not
>> correctly handled in get_nodes(), where --maxnode cause the calculation
>> endmask = (1UL << (maxnode % BITS_PER_LONG)) - 1;
>> ignores the highest node ID bit. Then, at
>> nodes_addr(*nodes)[nlongs-1] &= endmask;
>> the highest node ID bit is cleared. Finally, cause mpol_new() think user
>> does not pass in any node ID, and return EINVAL.
>>
>> The results are:
>> - Application receives EINVAL when only the highest node ID bit is set.
>> - Application recevies no error when other bits set together with the
>> highest node ID bit, but that highest ID is ignored.
>
>A similar patch has been posted [1] and rejected [2].
>
>[1] http://lkml.kernel.org/r/1570882789-20579-1-git-send-email-zhangpan26@huawei.com
>[2] http://lkml.kernel.org/r/20191014091243.GD317@dhcp22.suse.cz
>
>
>--
>Michal Hocko
>SUSE Labs
I just checked the code in 'history' log for curiosity, this --maxnode seems
appeared since the very first commit. Mention about this special point of
maxnode in manpage of these three APIs would be one solution, :).
Xinhai
next prev parent reply other threads:[~2019-11-08 16:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 15:49 Li Xinhai
2019-11-08 16:04 ` Michal Hocko
2019-11-08 16:48 ` lixinhai.lxh [this message]
2019-11-11 10:04 ` Michal Hocko
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=2019110900475976433214@gmail.com \
--to=lixinhai.lxh@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--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