mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Alexandre Ghiti <alexghiti@rivosinc.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: Re: [PATCH 0/4] riscv: Introduce KASLR
Date: Tue, 21 Feb 2023 16:50:36 +0100	[thread overview]
Message-ID: <878rgrqapf.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20230215145113.465558-1-alexghiti@rivosinc.com>

Alexandre Ghiti <alexghiti@rivosinc.com> writes:

> The following KASLR implementation allows to randomize the kernel mapping:
>
> - virtually: we expect the bootloader to provide a seed in the device-tree
> - physically: only implemented in the EFI stub, it relies on the firmware to
>   provide a seed using EFI_RNG_PROTOCOL. arm64 has a similar implementation
>   hence the patch 3 factorizes KASLR related functions for riscv to take
>   advantage.
>
> The new virtual kernel location is limited by the early page table that only
> has one PUD and with the PMD alignment constraint, the kernel can only take
> < 512 positions.
>
> Note that the patch "riscv: Use PUD/P4D/PGD pages for the linear
> mapping" is necessary to retrieve the memory below the physical kernel
> address, so that the EFI stub does not have to try to relocate the kernel
> as close as possible to the start of dram.
>
> This patchset is rebased on top of:
>
> Introduce 64b relocatable kernel (https://lore.kernel.org/lkml/20230215143626.453491-1-alexghiti@rivosinc.com/)
> RISC-V kasan rework (https://lore.kernel.org/lkml/Y6TTvku%2FyuSjm42j@spud/T/)
> riscv: Use PUD/P4D/PGD pages for the linear mapping (https://lore.kernel.org/lkml/20230125114229.hrhsyw4aegrnmoau@orel/T/)
> riscv: Allow to downgrade paging mode from the command line (https://lore.kernel.org/lkml/CAHVXubjeSMvfTPnvrnYRupOGx6+vUvUGfRS3piTeo=TH2cHKNg@mail.gmail.com/)
> base-commit-tag: v6.2-rc7
>
> This patchset was tested with u-boot boottime service for the seed on:
> - ubuntu defconfig + kasan outline (sv39, sv48, sv57): OK
> - ubuntu defconfig + kasan inline (sv39, sv48, sv57): OK
> - ubuntu defconfg (sv39, sv48, sv57): OK

I've taken the series for a spin (qemu u-boot UEFI, and qemu non-UEFI),
on-top of the patches outline above, but with 6.2 proper.

For the series:
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>

      parent reply	other threads:[~2023-02-21 15:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 14:51 Alexandre Ghiti
2023-02-15 14:51 ` [PATCH 1/4] riscv: Introduce virtual kernel mapping KASLR Alexandre Ghiti
2023-02-15 14:51 ` [PATCH 2/4] riscv: Dump out kernel offset information on panic Alexandre Ghiti
2023-02-15 14:51 ` [PATCH 3/4] arm64: libstub: Move KASLR handling functions to efi-stub-helper.c Alexandre Ghiti
2023-02-15 14:51 ` [PATCH 4/4] riscv: libstub: Implement KASLR by using generic functions Alexandre Ghiti
2023-02-21 15:50 ` Björn Töpel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rgrqapf.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®