diff options
author | Kees Cook <kees@kernel.org> | 2024-06-12 21:59:18 +0200 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-06-15 03:31:33 +0200 |
commit | 51104c19d8570eb23208e08eac0e9ae09ced1c15 (patch) | |
tree | e3667f8ff7dda66f1a79d5f848a9de66a1b6b530 /mm/util.c | |
parent | list: test: add the missing MODULE_DESCRIPTION() macro (diff) | |
download | linux-51104c19d8570eb23208e08eac0e9ae09ced1c15.tar.xz linux-51104c19d8570eb23208e08eac0e9ae09ced1c15.zip |
kunit: test: Add vm_mmap() allocation resource manager
For tests that need to allocate using vm_mmap() (e.g. usercopy and
execve), provide the interface to have the allocation tracked by KUnit
itself. This requires bringing up a placeholder userspace mm.
This combines my earlier attempt at this with Mark Rutland's version[1].
Normally alloc_mm() and arch_pick_mmap_layout() aren't exported for
modules, so export these only for KUnit testing.
Link: https://lore.kernel.org/lkml/20230321122514.1743889-2-mark.rutland@arm.com/ [1]
Co-developed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c index c9e519e6811f..df37c47d9374 100644 --- a/mm/util.c +++ b/mm/util.c @@ -26,6 +26,8 @@ #include <linux/uaccess.h> +#include <kunit/visibility.h> + #include "internal.h" #include "swap.h" @@ -482,6 +484,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) clear_bit(MMF_TOPDOWN, &mm->flags); } #endif +EXPORT_SYMBOL_IF_KUNIT(arch_pick_mmap_layout); /** * __account_locked_vm - account locked pages to an mm's locked_vm |