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: <CAHp75Vf1G6bpVvOHdG598o5oOZ3=S=ecsct-GhkyK0e+=FE_DQ@mail.gmail.com>
Date:   Tue, 9 Jun 2020 12:40:14 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Alexander Gordeev <agordeev@...ux.ibm.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-s390@...r.kernel.org, Stable <stable@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Yury Norov <yury.norov@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Amritha Nambiar <amritha.nambiar@...el.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Chris Wilson <chris@...is-wilson.co.uk>,
        Kees Cook <keescook@...omium.org>,
        Matthew Wilcox <willy@...radead.org>,
        Miklos Szeredi <mszeredi@...hat.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Steffen Klassert <steffen.klassert@...unet.com>,
        "Tobin C . Harding" <tobin@...nel.org>,
        Vineet Gupta <vineet.gupta1@...opsys.com>,
        Will Deacon <will.deacon@....com>,
        Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH v2] lib: fix bitmap_parse() on 64-bit big endian archs

On Mon, Jun 8, 2020 at 8:47 PM Alexander Gordeev <agordeev@...ux.ibm.com> wrote:
>
> Commit 2d6261583be0 ("lib: rework bitmap_parse()") does not
> take into account order of halfwords on 64-bit big endian
> architectures. As result (at least) Receive Packet Steering,
> IRQ affinity masks and runtime kernel test "test_bitmap" get
> broken on s390.

LGTM (I would replace while loop, but it's style preference and one
can consider worse than infinite loop)

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

>
> Fixes: 2d6261583be0 ("lib: rework bitmap_parse()")
> Cc: stable@...r.kernel.org
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Yury Norov <yury.norov@...il.com>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: Amritha Nambiar <amritha.nambiar@...el.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Chris Wilson <chris@...is-wilson.co.uk>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Miklos Szeredi <mszeredi@...hat.com>
> Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
> Cc: Steffen Klassert <steffen.klassert@...unet.com>
> Cc: "Tobin C . Harding" <tobin@...nel.org>
> Cc: Vineet Gupta <vineet.gupta1@...opsys.com>
> Cc: Will Deacon <will.deacon@....com>
> Cc: Willem de Bruijn <willemb@...gle.com>
> Signed-off-by: Alexander Gordeev <agordeev@...ux.ibm.com>
> ---
>  lib/bitmap.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/bitmap.c b/lib/bitmap.c
> index 89260aa342d6..80d26b183248 100644
> --- a/lib/bitmap.c
> +++ b/lib/bitmap.c
> @@ -739,6 +739,7 @@ int bitmap_parse(const char *start, unsigned int buflen,
>         const char *end = strnchrnul(start, buflen, '\n') - 1;
>         int chunks = BITS_TO_U32(nmaskbits);
>         u32 *bitmap = (u32 *)maskp;
> +       int chunk = 0;
>         int unset_bit;
>
>         while (1) {
> @@ -749,9 +750,14 @@ int bitmap_parse(const char *start, unsigned int buflen,
>                 if (!chunks--)
>                         return -EOVERFLOW;
>
> -               end = bitmap_get_x32_reverse(start, end, bitmap++);
> +#if defined(CONFIG_64BIT) && defined(__BIG_ENDIAN)
> +               end = bitmap_get_x32_reverse(start, end, &bitmap[chunk ^ 1]);
> +#else
> +               end = bitmap_get_x32_reverse(start, end, &bitmap[chunk]);
> +#endif
>                 if (IS_ERR(end))
>                         return PTR_ERR(end);
> +               chunk++;
>         }
>
>         unset_bit = (BITS_TO_U32(nmaskbits) - chunks) * 32;
> --
> 2.23.0
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ