[0/2] riscv: Increase mmap_rnd_bits_max on Sv48/57

Message ID 20230929211155.3910949-4-samitolvanen@google.com
Headers
Series riscv: Increase mmap_rnd_bits_max on Sv48/57 |

Message

Sami Tolvanen Sept. 29, 2023, 9:11 p.m. UTC
  Hi all,

We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24
even if the hardware supports a larger virtual address space size
[1]. These two patches allow mmap_rnd_bits_max to be changed during
init, and bumps up the maximum randomness if we end up setting up
4/5-level paging at boot.

Sami

 [1] https://github.com/google/android-riscv64/issues/1


Sami Tolvanen (2):
  mm: Change mmap_rnd_bits_max to __ro_after_init
  riscv: mm: Update mmap_rnd_bits_max

 arch/riscv/mm/init.c | 6 ++++++
 include/linux/mm.h   | 2 +-
 mm/mmap.c            | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)


base-commit: 6465e260f48790807eef06b583b38ca9789b6072
  

Comments

Palmer Dabbelt Dec. 6, 2023, 1:14 p.m. UTC | #1
On Fri, 29 Sep 2023 14:11:56 PDT (-0700), samitolvanen@google.com wrote:
> Hi all,
>
> We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24
> even if the hardware supports a larger virtual address space size
> [1]. These two patches allow mmap_rnd_bits_max to be changed during
> init, and bumps up the maximum randomness if we end up setting up
> 4/5-level paging at boot.

Sorry for missing this, I'm just poking through old stuff in patchwork.  
As far as I can tell this is still relevant, the discussions are just on 
the mmap() bits (but we'd already screwed that one up and have since 
fixed it).

So

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

in case someone else wants to take it, but I'm OK taking that MM patch 
with Kees' review.

>
> Sami
>
>  [1] https://github.com/google/android-riscv64/issues/1
>
>
> Sami Tolvanen (2):
>   mm: Change mmap_rnd_bits_max to __ro_after_init
>   riscv: mm: Update mmap_rnd_bits_max
>
>  arch/riscv/mm/init.c | 6 ++++++
>  include/linux/mm.h   | 2 +-
>  mm/mmap.c            | 2 +-
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
>
> base-commit: 6465e260f48790807eef06b583b38ca9789b6072
  
Kees Cook Dec. 6, 2023, 8:28 p.m. UTC | #2
On Wed, Dec 06, 2023 at 05:14:26AM -0800, Palmer Dabbelt wrote:
> On Fri, 29 Sep 2023 14:11:56 PDT (-0700), samitolvanen@google.com wrote:
> > Hi all,
> > 
> > We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24
> > even if the hardware supports a larger virtual address space size
> > [1]. These two patches allow mmap_rnd_bits_max to be changed during
> > init, and bumps up the maximum randomness if we end up setting up
> > 4/5-level paging at boot.
> 
> Sorry for missing this, I'm just poking through old stuff in patchwork.  As
> far as I can tell this is still relevant, the discussions are just on the
> mmap() bits (but we'd already screwed that one up and have since fixed it).
> 
> So
> 
> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> 
> in case someone else wants to take it, but I'm OK taking that MM patch with
> Kees' review.

Yes, thanks! Please do. I already +1ed it:
https://lore.kernel.org/all/202309291454.436E19663@keescook

-Kees
  
Sami Tolvanen Jan. 17, 2024, 8:29 p.m. UTC | #3
Hi Palmer,

On Wed, Dec 6, 2023 at 5:14 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Fri, 29 Sep 2023 14:11:56 PDT (-0700), samitolvanen@google.com wrote:
> > Hi all,
> >
> > We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24
> > even if the hardware supports a larger virtual address space size
> > [1]. These two patches allow mmap_rnd_bits_max to be changed during
> > init, and bumps up the maximum randomness if we end up setting up
> > 4/5-level paging at boot.
>
> Sorry for missing this, I'm just poking through old stuff in patchwork.
> As far as I can tell this is still relevant, the discussions are just on
> the mmap() bits (but we'd already screwed that one up and have since
> fixed it).
>
> So
>
> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
>
> in case someone else wants to take it, but I'm OK taking that MM patch
> with Kees' review.

Is this still on your radar for v6.8 or would you prefer me to resend
the patches?

Sami
  
patchwork-bot+linux-riscv@kernel.org Jan. 25, 2024, 9:30 p.m. UTC | #4
Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Fri, 29 Sep 2023 21:11:56 +0000 you wrote:
> Hi all,
> 
> We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24
> even if the hardware supports a larger virtual address space size
> [1]. These two patches allow mmap_rnd_bits_max to be changed during
> init, and bumps up the maximum randomness if we end up setting up
> 4/5-level paging at boot.
> 
> [...]

Here is the summary with links:
  - [1/2] mm: Change mmap_rnd_bits_max to __ro_after_init
    https://git.kernel.org/riscv/c/71a5849aedaa
  - [2/2] riscv: mm: Update mmap_rnd_bits_max
    https://git.kernel.org/riscv/c/7df1ff5a5cd6

You are awesome, thank you!