Skip to content

mm/vma: make more mmap logic userland testable

Lorenzo Stoakes linux-fsdevel linux-mm lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 14 repliesIn review 4 of 5 applied

Patches in v1 4 of 5 applied

#Subject and filesSizeRepliesApplied
1/5mm/vma: move brk() internals to mm/vma.cmm/mmap.c mm/vma.c mm/vma.h +1 more+108 -842 replies
2/5mm/vma: move unmapped_area() internals to mm/vma.cmm/mmap.c mm/vma.c mm/vma.h +2 more+177 -1090 repliesApplied
3/5mm: abstract get_arg_page() stack expansion and mmap read lockfs/exec.c include/linux/mm.h mm/mmap.c+58 -157 repliesApplied
4/5mm/vma: move stack expansion logic to mm/vma.cmm/mmap.c mm/vma.c mm/vma.h +2 more+310 -2431 replyApplied
5/5mm/vma: move __vm_munmap() to mm/vma.cmm/mmap.c mm/vma.c mm/vma.h +1 more+29 -180 repliesApplied

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchKees Cook
1/5
2/5
3/5A-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] mm/vma: make more mmap logic userland testable

This series carries on the work the work started in previous series and continued in commit 52956b0d7fb9 ("mm: isolate mmap internal logic to mm/vma.c"), moving the remainder of memory mapping implementation details logic into mm/vma.c allowing the bulk of the mapping logic to be unit tested.

It is highly useful to do so, as this means we can both fundamentally test this core logic, and introduce regression tests to ensure any issues previously resolved do not recur.

Vitally, this includes the do_brk_flags() function, meaning we have both core means of userland mapping memory now testable.

Performance testing was performed after this change given the brk() system call's sensitivity to change, and no performance regression was observed.

The stack expansion logic is also moved into mm/vma.c, which necessitates a change in the API exposed to the exec code, removing the invocation of the expand_downwards() function used in get_arg_page() and instead adding mmap_read_lock_maybe_expand() to wrap this.

Lorenzo Stoakes (5):
mm/vma: move brk() internals to mm/vma.c
mm/vma: move unmapped_area() internals to mm/vma.c
mm: abstract get_arg_page() stack expansion and mmap read lock mm/vma: move stack expansion logic to mm/vma.c mm/vma: move __vm_munmap() to mm/vma.c

 fs/exec.c                        |  14 +-
 include/linux/mm.h               |   5 +-
 mm/mmap.c                        | 469 ++++--------------------------
 mm/vma.c                         | 478 ++++++++++++++++++++++++++++---
 mm/vma.h                         |  20 +-
 tools/testing/vma/vma.c          |  11 +
 tools/testing/vma/vma_internal.h | 152 ++++++++++
 7 files changed, 681 insertions(+), 468 deletions(-)

--
2.47.1