lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5E266B49-F765-438D-870A-E9F6D8646F20@chromium.org>
Date:   Tue, 17 May 2022 17:56:04 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Yury Norov <yury.norov@...il.com>
CC:     Christophe de Dinechin <dinechin@...hat.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Zhen Lei <thunder.leizhen@...wei.com>,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2 0/2] bitmap: Fix return values to be unsigned



On May 17, 2022 3:21:00 PM PDT, Yury Norov <yury.norov@...il.com> wrote:
>On Tue, May 17, 2022 at 02:22:32PM -0700, Kees Cook wrote:
>> Hi,
>> 
>> As mentioned in the last patch:
>> 
>> Both nodemask and bitmap routines had mixed return values that provided
>> potentially signed results that could never happen. This was leading to
>> the compiler getting confusing about the range of possible return values
>> (it was thinking things could be negative where they could not be). Fix
>> all the nodemask and bitmap routines that should be returning unsigned
>> (or bool) values. Silences GCC 12 warnings:
>> 
>>  mm/swapfile.c: In function ‘setup_swap_info’:
>>  mm/swapfile.c:2291:47: error: array subscript -1 is below array bounds of ‘struct plist_node[]’ [-Werror=array-bounds]
>>   2291 |                                 p->avail_lists[i].prio = 1;
>>        |                                 ~~~~~~~~~~~~~~^~~
>>  In file included from mm/swapfile.c:16:
>>  ./include/linux/swap.h:292:27: note: while referencing ‘avail_lists’
>>    292 |         struct plist_node avail_lists[]; /*
>>        |                           ^~~~~~~~~~~
>> 
>> This splits up the patch into the bitmap and nodemask halves, and drops
>> a needless change to the random node helper.
>> 
>> I note that Alexey and Rasmus touched on this area in the past, fixing
>> up node ids to be unsigned:
>> 
>> ce0725f78a56 ("numa: make "nr_online_nodes" unsigned int")
>> b9726c26dc21 ("numa: make "nr_node_ids" unsigned int")
>> 33c4fa8c6763 ("linux/nodemask.h: update bitmap wrappers to take unsigned int")
>> 
>> If anyone else would like to carry this, please let me know. I'm happy
>> to carry it in my tree.
>
>I think it should go thru my tree, if no objections.

Sure thing! Thanks for the review. I'll send a v3 with the variable updated and tools/ refreshed.

-Kees


-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ