[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e3f287fc-c4d8-e0c2-90ba-ddfa3cb57e29@c-s.fr>
Date: Mon, 29 Jul 2019 13:16:21 +0200
From: Christophe Leroy <christophe.leroy@....fr>
To: Jason Yan <yanaijie@...wei.com>, mpe@...erman.id.au,
linuxppc-dev@...ts.ozlabs.org, diana.craciun@....com,
benh@...nel.crashing.org, paulus@...ba.org, npiggin@...il.com,
keescook@...omium.org, kernel-hardening@...ts.openwall.com
Cc: linux-kernel@...r.kernel.org, wangkefeng.wang@...wei.com,
yebin10@...wei.com, thunder.leizhen@...wei.com,
jingxiangfeng@...wei.com, fanchengyang@...wei.com
Subject: Re: [RFC PATCH 06/10] powerpc/fsl_booke/32: implement KASLR
infrastructure
Le 17/07/2019 à 10:06, Jason Yan a écrit :
> This patch add support to boot kernel from places other than KERNELBASE.
> Since CONFIG_RELOCATABLE has already supported, what we need to do is
> map or copy kernel to a proper place and relocate. Freescale Book-E
> parts expect lowmem to be mapped by fixed TLB entries(TLB1). The TLB1
> entries are not suitable to map the kernel directly in a randomized
> region, so we chose to copy the kernel to a proper place and restart to
> relocate.
>
> The offset of the kernel was not randomized yet(a fixed 64M is set). We
> will randomize it in the next patch.
>
> Signed-off-by: Jason Yan <yanaijie@...wei.com>
> Cc: Diana Craciun <diana.craciun@....com>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Christophe Leroy <christophe.leroy@....fr>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Nicholas Piggin <npiggin@...il.com>
> Cc: Kees Cook <keescook@...omium.org>
> ---
> arch/powerpc/Kconfig | 11 +++
> arch/powerpc/kernel/Makefile | 1 +
> arch/powerpc/kernel/early_32.c | 2 +-
> arch/powerpc/kernel/fsl_booke_entry_mapping.S | 13 ++-
> arch/powerpc/kernel/head_fsl_booke.S | 15 +++-
> arch/powerpc/kernel/kaslr_booke.c | 83 +++++++++++++++++++
> arch/powerpc/mm/mmu_decl.h | 6 ++
> arch/powerpc/mm/nohash/fsl_booke.c | 7 +-
> 8 files changed, 125 insertions(+), 13 deletions(-)
> create mode 100644 arch/powerpc/kernel/kaslr_booke.c
>
[...]
> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
> index dae8e9177574..754ae1e69f92 100644
> --- a/arch/powerpc/mm/mmu_decl.h
> +++ b/arch/powerpc/mm/mmu_decl.h
> @@ -148,6 +148,12 @@ extern void reloc_kernel_entry(void *fdt, int addr);
> extern void loadcam_entry(unsigned int index);
> extern void loadcam_multi(int first_idx, int num, int tmp_idx);
>
> +#ifdef CONFIG_RANDOMIZE_BASE
> +extern void kaslr_early_init(void *dt_ptr, phys_addr_t size);
No superflous 'extern' keyword.
Christophe
> +#else
> +static inline void kaslr_early_init(void *dt_ptr, phys_addr_t size) {}
> +#endif
> +
> struct tlbcam {
> u32 MAS0;
> u32 MAS1;
Powered by blists - more mailing lists