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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Mar 2023 14:20:50 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Tom Rix <trix@...hat.com>, Kees Cook <keescook@...omium.org>
Cc:     mhiramat@...nel.org, akpm@...ux-foundation.org,
        masahiroy@...nel.org, paulmck@...nel.org, hannes@...xchg.org,
        ojeda@...nel.org, thunder.leizhen@...wei.com,
        christophe.leroy@...roup.eu, vbabka@...e.cz,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] init/Kconfig: extend -Wno-array-bounds to gcc 13

+ Kees
https://lore.kernel.org/lkml/20230306220947.1982272-1-trix@redhat.com/

On Mon, Mar 6, 2023 at 2:10 PM Tom Rix <trix@...hat.com> wrote:
>
> With gcc 13.0.1 on x86, there are several false positives like
>
> drivers/net/ethernet/microchip/sparx5/sparx5_psfp.c:167:31:
>   error: array subscript 4 is above array bounds of ‘const struct sparx5_psfp_gce[4]’ [-Werror=array-bounds=]
>   167 |                 gce = &sg->gce[i];
>       |                        ~~~~~~~^~~
> In file included from drivers/net/ethernet/microchip/sparx5/sparx5_psfp.c:8:
> drivers/net/ethernet/microchip/sparx5/sparx5_main.h:506:32: note: while referencing ‘gce’
>   506 |         struct sparx5_psfp_gce gce[SPX5_PSFP_GCE_CNT];
>       |                                ^~~
>
> The code lines for the reported problem
>         /* For each scheduling entry */
>         for (i = 0; i < sg->num_entries; i++) {
>                 gce = &sg->gce[i];
>
> i is bounded by num_entries, which is set in sparx5_tc_flower.c
>         if (act->gate.num_entries >= SPX5_PSFP_GCE_CNT) {
>                 NL_SET_ERR_MSG_MOD(extack, "Invalid number of gate entries");
>                 return -EINVAL;
>         }
> ..
>         sg->num_entries = act->gate.num_entries;
>
> So disable array-bounds as was done on gcc 11 and 12
>
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
>  init/Kconfig | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 1fb5f313d18f..10d0a0020726 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -898,10 +898,14 @@ config GCC11_NO_ARRAY_BOUNDS
>  config GCC12_NO_ARRAY_BOUNDS
>         def_bool y
>
> +config GCC13_NO_ARRAY_BOUNDS
> +       def_bool y
> +
>  config CC_NO_ARRAY_BOUNDS
>         bool
>         default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_ARRAY_BOUNDS
>         default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 130000 && GCC12_NO_ARRAY_BOUNDS
> +       default y if CC_IS_GCC && GCC_VERSION >= 130000 && GCC_VERSION < 140000 && GCC13_NO_ARRAY_BOUNDS
>
>  #
>  # For architectures that know their GCC __int128 support is sound
> --
> 2.27.0
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ