kunit: test: Export kunit_attach_mm()
authorTiffany Yang <ynaffit@google.com>
Mon, 14 Jul 2025 18:53:16 +0000 (11:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2025 12:11:58 +0000 (14:11 +0200)
commitbdfa89c489296f092751fcee23b5d171c9fdc7f5
tree2012bf089adf1bad32eca1bc9453fd5e4bc545e5
parent4328a52642993a0f64c6f9f39b93d2abea0b1a72
kunit: test: Export kunit_attach_mm()

Tests can allocate from virtual memory using kunit_vm_mmap(), which
transparently creates and attaches an mm_struct to the test runner if
one is not already attached. This is suitable for most cases, except for
when the code under test must access a task's mm before performing an
mmap. Expose kunit_attach_mm() as part of the interface for those
cases. This does not change the existing behavior.

Cc: David Gow <davidgow@google.com>
Signed-off-by: Tiffany Yang <ynaffit@google.com>
Reviewed-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250714185321.2417234-4-ynaffit@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/kunit/test.h
lib/kunit/user_alloc.c