On Sat 09-11-19 00:48:01, lixinhai.lxh@xxxxxxxxx wrote: > 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@xxxxxxxxxx > >[2] http://lkml.kernel.org/r/20191014091243.GD317@xxxxxxxxxxxxxx > > > > > >-- > >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, :). Yes documenting this would be preferable. -- Michal Hocko SUSE Labs