diff options
| author | 2025-07-14 11:53:16 -0700 | |
|---|---|---|
| committer | 2025-07-16 14:11:58 +0200 | |
| commit | bdfa89c489296f092751fcee23b5d171c9fdc7f5 (patch) | |
| tree | 2012bf089adf1bad32eca1bc9453fd5e4bc545e5 /lib/kunit/user_alloc.c | |
| parent | binder: Store lru freelist in binder_alloc (diff) | |
| download | wireguard-linux-bdfa89c489296f092751fcee23b5d171c9fdc7f5.tar.xz wireguard-linux-bdfa89c489296f092751fcee23b5d171c9fdc7f5.zip | |
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>
Diffstat (limited to 'lib/kunit/user_alloc.c')
| -rw-r--r-- | lib/kunit/user_alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/kunit/user_alloc.c b/lib/kunit/user_alloc.c index 46951be018be..b8cac765e620 100644 --- a/lib/kunit/user_alloc.c +++ b/lib/kunit/user_alloc.c @@ -22,8 +22,7 @@ struct kunit_vm_mmap_params { unsigned long offset; }; -/* Create and attach a new mm if it doesn't already exist. */ -static int kunit_attach_mm(void) +int kunit_attach_mm(void) { struct mm_struct *mm; @@ -49,6 +48,7 @@ static int kunit_attach_mm(void) return 0; } +EXPORT_SYMBOL_GPL(kunit_attach_mm); static int kunit_vm_mmap_init(struct kunit_resource *res, void *context) { |
