2024-07-29 12:50:38 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
|
|
|
* vma_internal.h
|
|
|
|
*
|
|
|
|
* Headers required by vma.c, which can be substituted accordingly when testing
|
|
|
|
* VMA functionality.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MM_VMA_INTERNAL_H
|
|
|
|
#define __MM_VMA_INTERNAL_H
|
|
|
|
|
|
|
|
#include <linux/backing-dev.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/bug.h>
|
|
|
|
#include <linux/cacheflush.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/huge_mm.h>
|
2024-10-25 13:26:24 +01:00
|
|
|
#include <linux/hugetlb.h>
|
2024-07-29 12:50:38 +01:00
|
|
|
#include <linux/hugetlb_inline.h>
|
|
|
|
#include <linux/kernel.h>
|
2024-10-25 13:26:24 +01:00
|
|
|
#include <linux/ksm.h>
|
2024-07-29 12:50:38 +01:00
|
|
|
#include <linux/khugepaged.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/maple_tree.h>
|
|
|
|
#include <linux/mempolicy.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/mm_inline.h>
|
|
|
|
#include <linux/mm_types.h>
|
|
|
|
#include <linux/mman.h>
|
|
|
|
#include <linux/mmap_lock.h>
|
|
|
|
#include <linux/mmdebug.h>
|
|
|
|
#include <linux/mmu_context.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/pagemap.h>
|
2024-10-25 13:26:24 +01:00
|
|
|
#include <linux/perf_event.h>
|
mm/vma: move brk() internals to mm/vma.c
Patch series "mm/vma: make more mmap logic userland testable".
This series carries on 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.
This patch (of 5):
Now we have moved mmap_region() internals to mm/vma.c, making it available
to userland testing, it makes sense to do the same with brk().
This continues the pattern of VMA heavy lifting being done in mm/vma.c in
an environment where it can be subject to straightforward unit and
regression testing, with other VMA-adjacent files becoming wrappers around
this functionality.
[lorenzo.stoakes@oracle.com: add missing personality header import]
Link: https://lkml.kernel.org/r/2a717265-985f-45eb-9257-8b2857088ed4@lucifer.local
Link: https://lkml.kernel.org/r/cover.1733248985.git.lorenzo.stoakes@oracle.com
Link: https://lkml.kernel.org/r/3d24b9e67bb0261539ca921d1188a10a1b4d4357.1733248985.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-12-03 18:05:08 +00:00
|
|
|
#include <linux/personality.h>
|
2024-07-29 12:50:38 +01:00
|
|
|
#include <linux/pfn.h>
|
|
|
|
#include <linux/rcupdate.h>
|
|
|
|
#include <linux/rmap.h>
|
|
|
|
#include <linux/rwsem.h>
|
|
|
|
#include <linux/sched/signal.h>
|
2024-10-25 13:26:24 +01:00
|
|
|
#include <linux/security.h>
|
|
|
|
#include <linux/shmem_fs.h>
|
2024-07-29 12:50:38 +01:00
|
|
|
#include <linux/swap.h>
|
|
|
|
#include <linux/uprobes.h>
|
|
|
|
#include <linux/userfaultfd_k.h>
|
|
|
|
|
|
|
|
#include <asm/current.h>
|
|
|
|
#include <asm/tlb.h>
|
|
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
#endif /* __MM_VMA_INTERNAL_H */
|