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  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]
Date:   Wed, 18 May 2022 14:55:36 -0700
From:   Yury Norov <yury.norov@...il.com>
To:     Kees Cook <keescook@...omium.org>
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 v3 0/2] bitmap: Fix return values to be unsigned

On Wed, May 18, 2022 at 01:52:21PM -0700, Kees Cook wrote:
> Hi,
> 
> v1: https://lore.kernel.org/lkml/20220517035411.31144-1-keescook@chromium.org
> v2: https://lore.kernel.org/lkml/20220517212234.868181-1-keescook@chromium.org
> v3:
>  - Update missed int variable to unsigned int
>  - Update tools/ bitmaps code to match
>  - Adjust whitespace a bit
> 
> Rationale repeated from 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[]; /*
>        |                           ^~~~~~~~~~~
> 
> 
> I note that Alexey and Rasmus have 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")
> 
> -Kees
> 
> 
> Kees Cook (2):
>   bitmap: Fix return values to be unsigned
>   nodemask: Fix return values to be unsigned

Applied on https://github.com/norov/linux.git : bitmap-for-next.
Thanks!

>  include/linux/bitmap.h       | 25 ++++++++++++------------
>  include/linux/nodemask.h     | 38 ++++++++++++++++++------------------
>  lib/bitmap.c                 | 30 ++++++++++++++--------------
>  lib/nodemask.c               |  4 ++--
>  tools/include/linux/bitmap.h | 17 ++++++++--------
>  tools/lib/bitmap.c           | 20 +++++++++----------
>  6 files changed, 68 insertions(+), 66 deletions(-)
> 
> -- 
> 2.32.0

Powered by blists - more mailing lists