mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC 0/4] powerpc/book3s64/radix: Add support for memfd_secret
@ 2026-10-10 12:21 Ritesh Harjani (IBM)
  2026-10-10 12:21 ` [RFC 1/4] powerpc/64s: Add linear_map_use_base_page command line option Ritesh Harjani (IBM)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ritesh Harjani (IBM) @ 2026-10-10 12:21 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Madhavan Srinivasan, Michael Ellerman, Christophe Leroy,
	Venkat Rao Bagalkote, Shrikanth Hegde, linux-kernel,
	Ritesh Harjani (IBM)

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-10 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 12:21 [RFC 0/4] powerpc/book3s64/radix: Add support for memfd_secret Ritesh Harjani (IBM)
2026-10-10 12:21 ` [RFC 1/4] powerpc/64s: Add linear_map_use_base_page command line option Ritesh Harjani (IBM)
2026-10-10 12:21 ` [RFC 2/4] powerpc/64s/radix: Implement ARCH_HAS_SET_DIRECT_MAP Ritesh Harjani (IBM)
2026-10-10 12:21 ` [RFC 3/4] powerpc: Wire memfd_secret syscall Ritesh Harjani (IBM)
2026-10-10 12:21 ` [RFC 4/4] selftests: mm: Enable memfd_secret for powerpc Ritesh Harjani (IBM)

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®