[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJoLFjLqSByvegGNRGno+LMZhOikGiktywUw4tLHN6HiQ@mail.gmail.com>
Date: Thu, 4 Feb 2016 14:29:41 -0800
From: Kees Cook <keescook@...omium.org>
To: Daniel Cashman <dcashman@...roid.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: 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>
Subject: Re: [PATCH 0/2] Fix mmap_base entropy for >31 bits.
On Thu, Feb 4, 2016 at 2:06 PM, Daniel Cashman <dcashman@...roid.com> wrote:
> Upstream commit: d07e22597d1d355829b7b18ac19afa912cf758d1 added the
> ability to choose from a range of values to use for entropy count in
> generating the random offset to the mmap_base address. The
> maximum value on this range was set to 32 bits for 64-bit x86 systems,
> but this value could be increased further, requiring more than the 32
> bits of randomness provided by get_random_int(), as is already possible
> for arm64. Add a new function: get_random_long() which more naturally
> fits with the mmap usage of get_random_int() but operates exactly the
> same as get_random_int().
>
> Also, fix the shifting constant in mmap_rnd() to be an unsigned long so
> that values greater than 31 bits generate an appropriate mask without
> overflow. This is especially important on x86, as its shift instruction
> uses a 5-bit mask for the shift operand, which meant that any value for
> mmap_rnd_bits over 31 acts as a no-op and effectively disables mmap_base
> randomization.
>
> Finally, replace calls to get_random_int() with get_random_long() where
> appropriate.
>
> Daniel Cashman (2):
> drivers: char: random: Add get_random_long().
> use get_random_long().
>
> arch/arm/mm/mmap.c | 2 +-
> arch/arm64/mm/mmap.c | 4 ++--
> arch/mips/mm/mmap.c | 4 ++--
> arch/powerpc/kernel/process.c | 4 ++--
> arch/powerpc/mm/mmap.c | 4 ++--
> arch/sparc/kernel/sys_sparc_64.c | 2 +-
> arch/x86/mm/mmap.c | 6 +++---
> drivers/char/random.c | 22 ++++++++++++++++++++++
> fs/binfmt_elf.c | 2 +-
> include/linux/random.h | 1 +
> 10 files changed, 37 insertions(+), 14 deletions(-)
Thanks for fixing this!
Acked-by: Kees Cook <keescook@...omium.org>
-Kees
--
Kees Cook
Chrome OS & Brillo Security
Powered by blists - more mailing lists