mbox series

[0/2] mm: update mips to use do_mmap(), make mmap_region() internal

Message ID cover.1735819274.git.lorenzo.stoakes@oracle.com (mailing list archive)
Headers show
Series mm: update mips to use do_mmap(), make mmap_region() internal | expand

Message

Lorenzo Stoakes Jan. 2, 2025, 12:10 p.m. UTC
Currently the only user of mmap_region() outside of the memory management
code is the MIPS VDSO implementation.

This uses mmap_region() to map a 'delay slot emulation page' at the top of
the stack which is read-only and executable.

This mapping requires that an already-acquired mmap write lock is utilised
and that uffd and populate logic is ignored. This rules out vm_mmap(),
however do_mmap() fits the bill.

Adapt this code to use do_mmap() and then once done, make mmap_region()
internal and userland testable, and avoid any other uses of mmap_region(),
which is absolutely and strictly an internal mm function which bypasses a
great number of checks and logic.

v1:
* Stripped RFC, as Thomas indicated that the approach seemed correct from MIPS
  side.
* Avoided whitespace error as pointed out by Matthew.
* Rebased on tip mm-unstable, as previously a conflict emerged after I submitted
  the patch (quite possibly one I caused :P).

RFC:
https://lore.kernel.org/all/cover.1734017293.git.lorenzo.stoakes@oracle.com/

Lorenzo Stoakes (2):
  mips: vdso: prefer do_mmap() to mmap_region()
  mm: make mmap_region() internal

 arch/mips/kernel/vdso.c          | 10 +++--
 include/linux/mm.h               |  3 --
 mm/mmap.c                        | 59 -----------------------------
 mm/vma.c                         | 61 +++++++++++++++++++++++++++++-
 mm/vma.h                         |  2 +-
 tools/testing/vma/vma_internal.h | 65 ++++++++++++++++++++++++++++++++
 6 files changed, 132 insertions(+), 68 deletions(-)

--
2.47.1