.../admin-guide/kernel-parameters.txt | 5 +- arch/riscv/kernel/Makefile | 2 + arch/riscv/kernel/pi/Makefile | 34 ++++++++++++ arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++ arch/riscv/lib/memcpy.S | 2 + arch/riscv/lib/memmove.S | 2 + arch/riscv/mm/init.c | 36 ++++++++++--- 7 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 arch/riscv/kernel/pi/Makefile create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
This new version gets rid of the limitation that prevented KASAN kernels
to use the newly introduced parameters.
While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
avoid relocating the kernel twice for KASLR"): it allows to use the fdt
functions very early in the boot process with KASAN enabled by simply
compiling a new version of those functions without instrumentation.
I had to change the handling of the command line parsing to make the
code self-contained in kernel/pi/cmd_early.c to avoid calling too many
__pi prefixed functions from outside this file.
I'll use this approach like arm64 to handle the extraction of the random
seedi from the device tree for KASLR.
@Ard: I copied the "pi" name but I have to admit I don't know what it
means.
Alexandre Ghiti (1):
riscv: Allow to downgrade paging mode from the command line
.../admin-guide/kernel-parameters.txt | 5 +-
arch/riscv/kernel/Makefile | 2 +
arch/riscv/kernel/pi/Makefile | 34 ++++++++++++
arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++
arch/riscv/lib/memcpy.S | 2 +
arch/riscv/lib/memmove.S | 2 +
arch/riscv/mm/init.c | 36 ++++++++++---
7 files changed, 126 insertions(+), 7 deletions(-)
create mode 100644 arch/riscv/kernel/pi/Makefile
create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
--
2.37.2
Alexandre Ghiti <alexghiti@rivosinc.com> writes:
> This new version gets rid of the limitation that prevented KASAN kernels
> to use the newly introduced parameters.
>
> While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
> avoid relocating the kernel twice for KASLR"): it allows to use the fdt
> functions very early in the boot process with KASAN enabled by simply
> compiling a new version of those functions without instrumentation.
>
> I had to change the handling of the command line parsing to make the
> code self-contained in kernel/pi/cmd_early.c to avoid calling too many
> __pi prefixed functions from outside this file.
>
> I'll use this approach like arm64 to handle the extraction of the random
> seedi from the device tree for KASLR.
>
> @Ard: I copied the "pi" name but I have to admit I don't know what it
> means.
__pi_ is for "position-independent" -- KASLR related.
For the (tiny ;-)) series:
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Hey Alex,
On Tue, Jan 31, 2023 at 04:11:14PM +0100, Alexandre Ghiti wrote:
> This new version gets rid of the limitation that prevented KASAN kernels
> to use the newly introduced parameters.
What's the base commit for this version?
Fails to apply for me on top of for-next, fixes, rc1, and linux-next :/
I also tried it on top of your KASAN series, but no luck there either!
Thanks,
Conor.
> While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
> avoid relocating the kernel twice for KASLR"): it allows to use the fdt
> functions very early in the boot process with KASAN enabled by simply
> compiling a new version of those functions without instrumentation.
>
> I had to change the handling of the command line parsing to make the
> code self-contained in kernel/pi/cmd_early.c to avoid calling too many
> __pi prefixed functions from outside this file.
>
> I'll use this approach like arm64 to handle the extraction of the random
> seedi from the device tree for KASLR.
>
> @Ard: I copied the "pi" name but I have to admit I don't know what it
> means.
>
> Alexandre Ghiti (1):
> riscv: Allow to downgrade paging mode from the command line
>
> .../admin-guide/kernel-parameters.txt | 5 +-
> arch/riscv/kernel/Makefile | 2 +
> arch/riscv/kernel/pi/Makefile | 34 ++++++++++++
> arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++
> arch/riscv/lib/memcpy.S | 2 +
> arch/riscv/lib/memmove.S | 2 +
> arch/riscv/mm/init.c | 36 ++++++++++---
> 7 files changed, 126 insertions(+), 7 deletions(-)
> create mode 100644 arch/riscv/kernel/pi/Makefile
> create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
>
> --
> 2.37.2
>
Hi Conor,
On Tue, Jan 31, 2023 at 8:25 PM Conor Dooley <conor@kernel.org> wrote:
>
> Hey Alex,
>
> On Tue, Jan 31, 2023 at 04:11:14PM +0100, Alexandre Ghiti wrote:
> > This new version gets rid of the limitation that prevented KASAN kernels
> > to use the newly introduced parameters.
>
> What's the base commit for this version?
> Fails to apply for me on top of for-next, fixes, rc1, and linux-next :/
> I also tried it on top of your KASAN series, but no luck there either!
Really sorry about that, that's the second time it happens, I'll
improve my workflow: I'll include the base-commit sha1/tag + a link to
all needed-but-not-yet-upstreamed patches.
Thanks for your time,
Alex
>
> Thanks,
> Conor.
>
> > While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
> > avoid relocating the kernel twice for KASLR"): it allows to use the fdt
> > functions very early in the boot process with KASAN enabled by simply
> > compiling a new version of those functions without instrumentation.
> >
> > I had to change the handling of the command line parsing to make the
> > code self-contained in kernel/pi/cmd_early.c to avoid calling too many
> > __pi prefixed functions from outside this file.
> >
> > I'll use this approach like arm64 to handle the extraction of the random
> > seedi from the device tree for KASLR.
> >
> > @Ard: I copied the "pi" name but I have to admit I don't know what it
> > means.
> >
> > Alexandre Ghiti (1):
> > riscv: Allow to downgrade paging mode from the command line
> >
> > .../admin-guide/kernel-parameters.txt | 5 +-
> > arch/riscv/kernel/Makefile | 2 +
> > arch/riscv/kernel/pi/Makefile | 34 ++++++++++++
> > arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++
> > arch/riscv/lib/memcpy.S | 2 +
> > arch/riscv/lib/memmove.S | 2 +
> > arch/riscv/mm/init.c | 36 ++++++++++---
> > 7 files changed, 126 insertions(+), 7 deletions(-)
> > create mode 100644 arch/riscv/kernel/pi/Makefile
> > create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
> >
> > --
> > 2.37.2
> >
On Thu, Feb 2, 2023 at 4:07 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> Hi Conor,
>
> On Tue, Jan 31, 2023 at 8:25 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > Hey Alex,
> >
> > On Tue, Jan 31, 2023 at 04:11:14PM +0100, Alexandre Ghiti wrote:
> > > This new version gets rid of the limitation that prevented KASAN kernels
> > > to use the newly introduced parameters.
> >
> > What's the base commit for this version?
And to answer your question: this patch applies nicely on top of
v6.2-rc6 + my KASAN patchset
(https://patchwork.kernel.org/project/linux-riscv/list/?series=715388)
> > Fails to apply for me on top of for-next, fixes, rc1, and linux-next :/
> > I also tried it on top of your KASAN series, but no luck there either!
>
> Really sorry about that, that's the second time it happens, I'll
> improve my workflow: I'll include the base-commit sha1/tag + a link to
> all needed-but-not-yet-upstreamed patches.
>
> Thanks for your time,
>
> Alex
>
> >
> > Thanks,
> > Conor.
> >
> > > While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
> > > avoid relocating the kernel twice for KASLR"): it allows to use the fdt
> > > functions very early in the boot process with KASAN enabled by simply
> > > compiling a new version of those functions without instrumentation.
> > >
> > > I had to change the handling of the command line parsing to make the
> > > code self-contained in kernel/pi/cmd_early.c to avoid calling too many
> > > __pi prefixed functions from outside this file.
> > >
> > > I'll use this approach like arm64 to handle the extraction of the random
> > > seedi from the device tree for KASLR.
> > >
> > > @Ard: I copied the "pi" name but I have to admit I don't know what it
> > > means.
> > >
> > > Alexandre Ghiti (1):
> > > riscv: Allow to downgrade paging mode from the command line
> > >
> > > .../admin-guide/kernel-parameters.txt | 5 +-
> > > arch/riscv/kernel/Makefile | 2 +
> > > arch/riscv/kernel/pi/Makefile | 34 ++++++++++++
> > > arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++
> > > arch/riscv/lib/memcpy.S | 2 +
> > > arch/riscv/lib/memmove.S | 2 +
> > > arch/riscv/mm/init.c | 36 ++++++++++---
> > > 7 files changed, 126 insertions(+), 7 deletions(-)
> > > create mode 100644 arch/riscv/kernel/pi/Makefile
> > > create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
> > >
> > > --
> > > 2.37.2
> > >
Sorry, I forgot the changelog again:
|v4: - Remove the kasan limitation by compiling 'local' fdt functions,
as done in arm64 by Ard - Remove RB from Björn as the cmdline handling
changed v3: - Massage commit log to make no4lvl clearer, as asked by
Conor - Add a note to kernel-parameters.txt regarding the impossibility
to use those parameters when KASAN is enabled, as suggested by Conor -
Add RB from Björn v2: - Honor CMDLINE_EXTEND and CMDLINE_FORCE as
noticed by Björn|
On 1/31/23 16:11, Alexandre Ghiti wrote:
> This new version gets rid of the limitation that prevented KASAN kernels
> to use the newly introduced parameters.
>
> While looking into KASLR, I fell onto commit aacd149b6238 ("arm64: head:
> avoid relocating the kernel twice for KASLR"): it allows to use the fdt
> functions very early in the boot process with KASAN enabled by simply
> compiling a new version of those functions without instrumentation.
>
> I had to change the handling of the command line parsing to make the
> code self-contained in kernel/pi/cmd_early.c to avoid calling too many
> __pi prefixed functions from outside this file.
>
> I'll use this approach like arm64 to handle the extraction of the random
> seedi from the device tree for KASLR.
>
> @Ard: I copied the "pi" name but I have to admit I don't know what it
> means.
>
> Alexandre Ghiti (1):
> riscv: Allow to downgrade paging mode from the command line
>
> .../admin-guide/kernel-parameters.txt | 5 +-
> arch/riscv/kernel/Makefile | 2 +
> arch/riscv/kernel/pi/Makefile | 34 ++++++++++++
> arch/riscv/kernel/pi/cmdline_early.c | 52 +++++++++++++++++++
> arch/riscv/lib/memcpy.S | 2 +
> arch/riscv/lib/memmove.S | 2 +
> arch/riscv/mm/init.c | 36 ++++++++++---
> 7 files changed, 126 insertions(+), 7 deletions(-)
> create mode 100644 arch/riscv/kernel/pi/Makefile
> create mode 100644 arch/riscv/kernel/pi/cmdline_early.c
>
© 2016 - 2026 Red Hat, Inc.