linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] move all VMA allocation, freeing and duplication logic to mm
@ 2025-04-24 21:15 Lorenzo Stoakes
  2025-04-24 21:15 ` [PATCH 1/4] mm: abstract initial stack setup to mm subsystem Lorenzo Stoakes
                   ` (3 more replies)
  0 siblings, 4 replies; 31+ messages in thread
From: Lorenzo Stoakes @ 2025-04-24 21:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Liam R . Howlett, Vlastimil Babka, Jann Horn, Pedro Falcato,
	David Hildenbrand, Kees Cook, Alexander Viro, Christian Brauner,
	Jan Kara, Suren Baghdasaryan, linux-mm, linux-fsdevel,
	linux-kernel

Currently VMA allocation, freeing and duplication exist in kernel/fork.c,
which is a violation of separation of concerns, and leaves these functions
exposed to the rest of the kernel when they are in fact internal
implementation details.

Resolve this by moving this logic to mm, and making it internal to vma.c,
vma.h.

This also allows us, in future, to provide userland testing around this
functionality.

We additionally abstract dup_mmap() to mm, being careful to ensure
kernel/fork.c acceses thi via the mm internal header so it is not exposed
elsewhere in the kernel.

As part of this change, also abstract initial stack allocation performed in
__bprm_mm_init() out of fs code into mm via the create_init_stack_vma(), as
this code uses vm_area_alloc() and vm_area_free().

Lorenzo Stoakes (4):
  mm: abstract initial stack setup to mm subsystem
  mm: perform VMA allocation, freeing, duplication in mm
  mm: move dup_mmap() to mm
  mm: move vm_area_alloc,dup,free() functions to vma.c

 fs/exec.c                        |  51 +-----
 include/linux/mm.h               |  15 +-
 kernel/fork.c                    | 277 +------------------------------
 mm/debug_vm_pgtable.c            |   2 +
 mm/internal.h                    |   2 +
 mm/mmap.c                        | 254 +++++++++++++++++++++++++++-
 mm/nommu.c                       |  75 +++++++++
 mm/vma.c                         |  89 ++++++++++
 mm/vma.h                         |   8 +
 tools/testing/vma/vma.c          |   1 +
 tools/testing/vma/vma_internal.h | 151 +++++++++++++----
 11 files changed, 550 insertions(+), 375 deletions(-)

--
2.49.0

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

end of thread, other threads:[~2025-04-25 17:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 21:15 [PATCH 0/4] move all VMA allocation, freeing and duplication logic to mm Lorenzo Stoakes
2025-04-24 21:15 ` [PATCH 1/4] mm: abstract initial stack setup to mm subsystem Lorenzo Stoakes
2025-04-24 21:30   ` David Hildenbrand
2025-04-25  0:55     ` Suren Baghdasaryan
2025-04-25 10:10       ` Lorenzo Stoakes
2025-04-25 10:11     ` Lorenzo Stoakes
2025-04-24 21:15 ` [PATCH 2/4] mm: perform VMA allocation, freeing, duplication in mm Lorenzo Stoakes
2025-04-24 21:22   ` David Hildenbrand
2025-04-25  1:22     ` Suren Baghdasaryan
2025-04-25  1:37       ` Suren Baghdasaryan
2025-04-25 10:10         ` Lorenzo Stoakes
2025-04-25 11:04           ` Lorenzo Stoakes
2025-04-25 10:09       ` Lorenzo Stoakes
2025-04-25 10:26         ` Liam R. Howlett
2025-04-25 10:31           ` Lorenzo Stoakes
2025-04-25 10:45             ` Lorenzo Stoakes
2025-04-25 11:00               ` Liam R. Howlett
2025-04-25 11:03                 ` Lorenzo Stoakes
2025-04-25 10:17     ` Lorenzo Stoakes
2025-04-25  3:15   ` Kees Cook
2025-04-25 10:40     ` Lorenzo Stoakes
2025-04-25 10:53       ` Pedro Falcato
2025-04-25 13:54       ` Liam R. Howlett
2025-04-25 15:32         ` Suren Baghdasaryan
2025-04-25 15:34           ` Suren Baghdasaryan
2025-04-25 17:12           ` Kees Cook
2025-04-25 17:26             ` Suren Baghdasaryan
2025-04-24 21:15 ` [PATCH 3/4] mm: move dup_mmap() to mm Lorenzo Stoakes
2025-04-25  9:13   ` Pedro Falcato
2025-04-25 10:18     ` Lorenzo Stoakes
2025-04-24 21:15 ` [PATCH 4/4] mm: move vm_area_alloc,dup,free() functions to vma.c Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).