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] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 Jun 2023 14:57:41 -0400
From: Paul Moore <paul@...l-moore.com>
To: Dmitry Mastykin <dmastykin@...ralinux.ru>
Cc: netdev@...r.kernel.org, linux-security-module@...r.kernel.org
Subject: Re: [PATCH] netlabel: fix shift wrapping bug in netlbl_catmap_setlong()

On Thu, Jun 8, 2023 at 9:58 AM Dmitry Mastykin <dmastykin@...ralinux.ru> wrote:
>
> There is a shift wrapping bug in this code on 32-bit architectures.
> NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long.
> Every second 32-bit word of catmap becomes corrupted.
>
> Signed-off-by: Dmitry Mastykin <dmastykin@...ralinux.ru>
> ---
>  net/netlabel/netlabel_kapi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks Dmitry.

Acked-by: Paul Moore <paul@...l-moore.com>

> diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
> index 54c083003947..27511c90a26f 100644
> --- a/net/netlabel/netlabel_kapi.c
> +++ b/net/netlabel/netlabel_kapi.c
> @@ -857,7 +857,8 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
>
>         offset -= iter->startbit;
>         idx = offset / NETLBL_CATMAP_MAPSIZE;
> -       iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE);
> +       iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap
> +                            << (offset % NETLBL_CATMAP_MAPSIZE);
>
>         return 0;
>  }
> --
> 2.30.2

-- 
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ