]> www.infradead.org Git - users/willy/xarray.git/commit
kunit: test: Add vm_mmap() allocation resource manager
authorKees Cook <kees@kernel.org>
Wed, 12 Jun 2024 19:59:18 +0000 (12:59 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Sat, 15 Jun 2024 01:31:33 +0000 (19:31 -0600)
commit51104c19d8570eb23208e08eac0e9ae09ced1c15
treee3667f8ff7dda66f1a79d5f848a9de66a1b6b530
parent425ae3ab5a1fa744a00680f059cf1accaaaecb28
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/
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>
include/kunit/test.h
kernel/fork.c
lib/kunit/Makefile
lib/kunit/user_alloc.c [new file with mode: 0644]
mm/util.c