From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22683C43331 for ; Mon, 11 Nov 2019 10:04:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D8C532084F for ; Mon, 11 Nov 2019 10:04:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8C532084F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6F5786B0005; Mon, 11 Nov 2019 05:04:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A65B6B0006; Mon, 11 Nov 2019 05:04:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 595426B0007; Mon, 11 Nov 2019 05:04:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 461AC6B0005 for ; Mon, 11 Nov 2019 05:04:50 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 022B42816 for ; Mon, 11 Nov 2019 10:04:50 +0000 (UTC) X-FDA: 76143562740.04.route38_645802af9bd02 X-HE-Tag: route38_645802af9bd02 X-Filterd-Recvd-Size: 2579 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 Nov 2019 10:04:49 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BA510B218; Mon, 11 Nov 2019 10:04:47 +0000 (UTC) Date: Mon, 11 Nov 2019 11:04:47 +0100 From: Michal Hocko To: "lixinhai.lxh@gmail.com" Cc: "linux-mm@kvack.org" , akpm , Vlastimil Babka , Hugh Dickins Subject: Re: [PATCH] mm: mempolicy: Fix wrong use of maxnode in mempolicy API Message-ID: <20191111100447.GE1396@dhcp22.suse.cz> References: <1573228169-30986-1-git-send-email-lixinhai.lxh@gmail.com> <20191108160456.GN15658@dhcp22.suse.cz> <2019110900475976433214@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <2019110900475976433214@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat 09-11-19 00:48:01, lixinhai.lxh@gmail.com wrote: > On 2019-11-09=A0at 00:04=A0Michal Hocko=A0wrote: > >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 calculat= ion > >>=A0=A0 endmask =3D (1UL << (maxnode % BITS_PER_LONG)) - 1; > >> ignores the highest node ID bit. Then, at > >>=A0=A0 nodes_addr(*nodes)[nlongs-1] &=3D 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 s= et. > >> - Application recevies no error when other bits set together with th= e > >>=A0=A0 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-zhangpa= n26@huawei.com > >[2] http://lkml.kernel.org/r/20191014091243.GD317@dhcp22.suse.cz > > > > > >-- > >Michal Hocko > >SUSE Labs=20 >=20 > I=A0just checked the code in 'history' log for curiosity, this --maxnod= e seems=20 > appeared=A0since the very first commit. Mention about this special poin= t of=20 > maxnode in manpage of these three APIs would be one solution, :). Yes documenting this would be preferable. --=20 Michal Hocko SUSE Labs