[PATCH v2 4/4] powerpc/64s: Enable KFENCE on book3s64
Christophe Leroy
christophe.leroy at csgroup.eu
Wed Sep 21 17:07:29 AEST 2022
Le 21/09/2022 à 04:02, Nicholas Miehlbradt a écrit :
> KFENCE support was added for ppc32 in commit 90cbac0e995d
> ("powerpc: Enable KFENCE for PPC32").
> Enable KFENCE on ppc64 architecture with hash and radix MMUs.
> It uses the same mechanism as debug pagealloc to
> protect/unprotect pages. All KFENCE kunit tests pass on both
> MMUs.
>
> KFENCE memory is initially allocated using memblock but is
> later marked as SLAB allocated. This necessitates the change
> to __pud_free to ensure that the KFENCE pages are freed
> appropriately.
>
> Based on previous work by Christophe Leroy and Jordan Niethe.
>
> Signed-off-by: Nicholas Miehlbradt <nicholas at linux.ibm.com>
> ---
> v2: Refactor
> ---
> arch/powerpc/Kconfig | 2 +-
> arch/powerpc/include/asm/book3s/64/pgalloc.h | 6 ++++--
> arch/powerpc/include/asm/book3s/64/pgtable.h | 2 +-
> arch/powerpc/include/asm/kfence.h | 15 +++++++++++++++
> arch/powerpc/mm/book3s64/hash_utils.c | 10 +++++-----
> arch/powerpc/mm/book3s64/radix_pgtable.c | 8 +++++---
> 6 files changed, 31 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kfence.h b/arch/powerpc/include/asm/kfence.h
> index a9846b68c6b9..cff60983e88d 100644
> --- a/arch/powerpc/include/asm/kfence.h
> +++ b/arch/powerpc/include/asm/kfence.h
> @@ -11,11 +11,25 @@
> #include <linux/mm.h>
> #include <asm/pgtable.h>
>
> +#if defined(CONFIG_PPC64) && !defined(CONFIG_PPC64_ELF_ABI_V2)
CONFIG_PPC64 && !CONFIG_PPC64_ELF_ABI_V2
is the same as
CONFIG_PPC64_ELF_ABI_V1
> +#define ARCH_FUNC_PREFIX "."
> +#endif
> +
Christophe
More information about the Linuxppc-dev
mailing list