Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1342435 > unrolled thread

Re: [PATCH 0/2] Fix mmap_base entropy for >31 bits.

Started byDaniel Cashman <dcashman@android.com>
First post2016-02-24 21:50 +0100
Last post2016-02-24 23:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 0/2] Fix mmap_base entropy for >31 bits. Daniel Cashman <dcashman@android.com> - 2016-02-24 21:50 +0100
    Re: [PATCH 0/2] Fix mmap_base entropy for >31 bits. Kees Cook <keescook@chromium.org> - 2016-02-24 23:00 +0100

#1342435 — Re: [PATCH 0/2] Fix mmap_base entropy for >31 bits.

FromDaniel Cashman <dcashman@android.com>
Date2016-02-24 21:50 +0100
SubjectRe: [PATCH 0/2] Fix mmap_base entropy for >31 bits.
Message-ID<r5OxI-1rH-7@gated-at.bofh.it>
On 02/04/2016 02:29 PM, Kees Cook wrote:
> On Thu, Feb 4, 2016 at 2:06 PM, Daniel Cashman <dcashman@android.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@chromium.org>
> 
> -Kees
> 

This has now been in linux-next for awhile. Could we please submit this
for the 4.5 rc window so that it fixes the issue in the final 4.5
release?  Sorry if this is a protocol breach, but I'm not sure what the
best way is for me to indicate that this is a "fix" that should go out
in the same release as the original feature.

Thank You,
Dan

[toc] | [next] | [standalone]


#1342463

FromKees Cook <keescook@chromium.org>
Date2016-02-24 23:00 +0100
Message-ID<r5PDs-2f7-1@gated-at.bofh.it>
In reply to#1342435
On Wed, Feb 24, 2016 at 12:40 PM, Daniel Cashman <dcashman@android.com> wrote:
> On 02/04/2016 02:29 PM, Kees Cook wrote:
>> On Thu, Feb 4, 2016 at 2:06 PM, Daniel Cashman <dcashman@android.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@chromium.org>
>>
>> -Kees
>>
>
> This has now been in linux-next for awhile. Could we please submit this
> for the 4.5 rc window so that it fixes the issue in the final 4.5
> release?  Sorry if this is a protocol breach, but I'm not sure what the
> best way is for me to indicate that this is a "fix" that should go out
> in the same release as the original feature.

Yes please! :) Andrew, can you push these for 4.5? Best to keep the
feature from releasing broken.

Thanks!

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web