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]
Message-ID: <CAGXu5jLOk52XzQT9EA8vq5B3G3ks8Nmsfc6keA8kpG9LvaTE9Q@mail.gmail.com>
Date:	Mon, 25 Jul 2016 11:54:02 -0700
From:	Kees Cook <keescook@...omium.org>
To:	"Roberts, William C" <william.c.roberts@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-mm@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	"Theodore Ts'o" <tytso@....edu>, Arnd Bergmann <arnd@...db.de>,
	Greg KH <gregkh@...uxfoundation.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will.deacon@....com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	"benh@...nel.crashing.org" <benh@...nel.crashing.org>,
	Paul Mackerras <paulus@...ba.org>,
	Michael Ellerman <mpe@...erman.id.au>,
	"David S. Miller" <davem@...emloft.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"x86@...nel.org" <x86@...nel.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Nick Kralevich <nnk@...gle.com>,
	Jeffrey Vander Stoep <jeffv@...gle.com>,
	Mark Salyzyn <salyzyn@...roid.com>,
	Daniel Cashman <dcashman@...roid.com>
Subject: Re: [PATCH] randomize_range: use random long instead of int

On Mon, Jul 25, 2016 at 11:25 AM,  <william.c.roberts@...el.com> wrote:
> From: William Roberts <william.c.roberts@...el.com>
>
> Use a long when generating the random range rather than
> an int. This will produce better random distributions as
> well as matching all the types at hand.
>
> Signed-off-by: William Roberts <william.c.roberts@...el.com>

I agree, this is what I pointed out back in Feb:
https://lkml.org/lkml/2016/2/4/854

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

Andrew, can you pick this up for 4.8?

-Kees

> ---
>  drivers/char/random.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 0158d3b..bbf11b5 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1837,7 +1837,8 @@ randomize_range(unsigned long start, unsigned long end, unsigned long len)
>
>         if (end <= start + len)
>                 return 0;
> -       return PAGE_ALIGN(get_random_int() % range + start);
> +
> +       return PAGE_ALIGN(get_random_long() % range + start);
>  }
>
>  /* Interface for in-kernel drivers of true hardware RNGs.
> --
> 1.9.1
>



-- 
Kees Cook
Chrome OS & Brillo Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ