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: <CAG_fn=W_7nqtKZdDOfjYT51+T-iqAyrmEHrH9O45k1OH8g_NKA@mail.gmail.com>
Date:   Thu, 12 Oct 2023 15:22:28 +0200
From:   Alexander Potapenko <glider@...gle.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     catalin.marinas@....com, will@...nel.org, pcc@...gle.com,
        andreyknvl@...il.com, aleksander.lobakin@...el.com,
        linux@...musvillemoes.dk, yury.norov@...il.com,
        alexandru.elisei@....com, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, eugenis@...gle.com,
        syednwaris@...il.com, william.gray@...aro.org
Subject: Re: [PATCH v7 2/5] lib/test_bitmap: add tests for bitmap_{read,write}()

On Wed, Oct 11, 2023 at 8:03 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Wed, Oct 11, 2023 at 07:28:32PM +0200, Alexander Potapenko wrote:
> > Add basic tests ensuring that values can be added at arbitrary positions
> > of the bitmap, including those spanning into the adjacent unsigned
> > longs.
>
> Would be nice to have an additional test like
>
>         bitmap_write(..., 33 /* or anything > 32 */);
>
> This will require ifdeffery. So at least this code may warn users about corner
> cases in the agnostic code.

We could go with bitmap_write(..., BITS_PER_LONG + 1):

        /*
         * Setting/getting more than BITS_PER_LONG bits should not crash the
         * kernel. READ_ONCE() prevents constant folding.
         */
        bitmap_write(NULL, 0, 0, READ_ONCE(bits_per_long) + 1);
        /* Return value of bitmap_read() is undefined here. */
        bitmap_read(NULL, 0, READ_ONCE(bits_per_long) + 1);

I'll add the above code in v8 (sometime next week, hope to receive
some comments from the ARM folks).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ