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]
Date:	Mon, 26 Oct 2015 15:45:04 +0900
From:	Kees Cook <keescook@...omium.org>
To:	Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Maurizio Lombardi <mlombard@...hat.com>,
	Tejun Heo <tj@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/13] lib/test_printf.c: add test for large bitmaps

On Wed, Oct 21, 2015 at 5:30 AM, Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
> Following "lib/vsprintf.c: expand field_width to 24 bits", let's add a
> test to see that we now actually support bitmaps with 65536 bits.
>
> Cc: Maurizio Lombardi <mlombard@...hat.com>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Tejun Heo <tj@...nel.org>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>

Acked-by: Kees Cook <keescook@...omium.org>

-Kees

> ---
>  lib/test_printf.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index 8fca007d9bcd..19fa411dba78 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -12,6 +12,7 @@
>  #include <linux/slab.h>
>  #include <linux/string.h>
>
> +#include <linux/bitmap.h>
>  #include <linux/socket.h>
>  #include <linux/in.h>
>
> @@ -312,6 +313,20 @@ struct_clk(void)
>  }
>
>  static void __init
> +large_bitmap(void)
> +{
> +       const int nbits = 1 << 16;
> +       unsigned long *bits = kcalloc(BITS_TO_LONGS(nbits), sizeof(long), GFP_KERNEL);
> +       if (!bits)
> +               return;
> +
> +       bitmap_set(bits, 1, 20);
> +       bitmap_set(bits, 60000, 15);
> +       test("1-20,60000-60014", "%*pbl", nbits, bits);
> +       kfree(bits);
> +}
> +
> +static void __init
>  bitmap(void)
>  {
>         DECLARE_BITMAP(bits, 20);
> @@ -330,6 +345,8 @@ bitmap(void)
>         bitmap_fill(bits, 20);
>         test("fffff|fffff", "%20pb|%*pb", bits, 20, bits);
>         test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits);
> +
> +       large_bitmap();
>  }
>
>  static void __init
> --
> 2.6.1
>



-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ