[RFC 0/4] powerpc/book3s64/radix: Add support for memfd_secret
From: Ritesh Harjani (IBM)
Date: Sat Oct 10 2026 - 08:22:01 EST
memfd_secret() gives a process a place to keep a secret that the kernel itself
should not be able to read. The page is still mapped in that process but it is
removed from the kernel linear map, so a kernel read or a speculative walk of
that map cannot see it.
On PowerPC book3s64, if the same address is translated by two pages of different
sizes at once, the TLB access can raise a machine check for a parity error or
a multi-hit. So that means breaking a 2M or a 1G mapping of kernel linear map is
not possible.
The way around that is to build the linear map out of base pages in the first
place and only then allow a single page to be dropped and put back. So, that is
what this series does by adding a linear_map_use_base_page cmdline option.
This is based out of mm-new branch for now (since few dependent function
definitions have been modified there). Once v7.4 is merge window closes - I will
rebase this to latest upstream powerpc tree.
Ritesh Harjani (IBM) (4):
powerpc/64s: Add linear_map_use_base_page command line option
powerpc/64s/radix: Implement ARCH_HAS_SET_DIRECT_MAP
powerpc: Wire memfd_secret syscall
selftests: mm: Enable memfd_secret for powerpc
.../admin-guide/kernel-parameters.txt | 10 ++
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/book3s/64/mmu.h | 2 +
arch/powerpc/include/asm/set_memory.h | 9 ++
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
arch/powerpc/mm/book3s64/pgtable.c | 22 +++++
arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +-
arch/powerpc/mm/pageattr.c | 96 +++++++++++++++++++
tools/testing/selftests/mm/Makefile | 2 +-
9 files changed, 143 insertions(+), 3 deletions(-)
--
2.39.5