Skip to content

RFC powerpc/book3s64/radix: Add support for memfd_secret

Ritesh Harjani (IBM) linuxppc-dev lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4powerpc/64s: Add linear_map_use_base_page command line optionDocumentation/admin-guide/kernel-parameters.txt arch/powerpc/include/asm/book3s/64/mmu.h arch/powerpc/mm/book3s64/pgtable.c +1 more+35 -10 replies
2/4powerpc/64s/radix: Implement ARCH_HAS_SET_DIRECT_MAParch/powerpc/Kconfig arch/powerpc/include/asm/set_memory.h arch/powerpc/mm/pageattr.c+106 -00 replies
3/4powerpc: Wire memfd_secret syscallarch/powerpc/kernel/syscalls/syscall.tbl+1 -10 replies
4/4selftests: mm: Enable memfd_secret for powerpctools/testing/selftests/mm/Makefile+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/4] powerpc/book3s64/radix: Add support for memfd_secret

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