kunit/usercopy: Disable testing on !CONFIG_MMU
Subsystems (5)
PATCH v2 1/1 kunit/usercopy: Disable testing on !CONFIG_MMU
Since arch_pick_mmap_layout() is an inline for non-MMU systems, disable this test there.
---
Resending as v2 with Shuah in To:
---
Cc: Shuah Khan <[email protected]>
Cc: Brendan Higgins <[email protected]>
Cc: David Gow <[email protected]>
Cc: Rae Moar <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- lib/kunit/user_alloc.c | 4 ++++ lib/usercopy_kunit.c | 5 +++++ mm/util.c | 2 ++ 3 files changed, 11 insertions(+)
lib/kunit/user_alloc.c +4 -0
@@ -30,6 +30,10 @@ static int kunit_attach_mm(void)if (current->mm)return 0 ; +/* arch_pick_mmap_layout() is only sane with MMU systems. */ +if (!IS_ENABLED (CONFIG_MMU )) +return -EINVAL ; + mm =mm_alloc ();if (!mm)return -ENOMEM ;
lib/usercopy_kunit.c +5 -0
@@ -290,6 +290,11 @@ static int usercopy_test_init(struct kunit *test)struct usercopy_test_priv *priv;unsigned long user_addr; +if (!IS_ENABLED (CONFIG_MMU )) { +kunit_skip (test,"Userspace allocation testing not available on non-MMU systems" ); +return 0 ; + } + priv =kunit_kzalloc (test,sizeof (*priv),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, priv); test->priv = priv;
mm/util.c +2 -0
@@ -484,7 +484,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) clear_bit(MMF_TOPDOWN, &mm->flags); }#endif +#ifdef CONFIG_MMU EXPORT_SYMBOL_IF_KUNIT (arch_pick_mmap_layout); +#endif /** * __account_locked_vm - account locked pages to an mm's locked_vm
Signature · 1 line
2.34.1
Quoted 7 lines · Kees Cook
Since
arch_pick_mmap_layout()is an inline for non-MMU systems, disable this test there.Reported-by kernel test robot <[email protected]>Signed-off-by Kees Cook <[email protected]>
Hello!
This looks good to me. And seems to fix the problem. Thanks for the fix!
-Rae
Quoted 67 lines
---
Resending as v2 with Shuah in To:
---
Cc: Shuah Khan <[email protected]>
Cc: Brendan Higgins <[email protected]>
Cc: David Gow <[email protected]>
Cc: Rae Moar <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- lib/kunit/user_alloc.c | 4 ++++ lib/usercopy_kunit.c | 5 +++++ mm/util.c | 2 ++ 3 files changed, 11 insertions(+)lib/kunit/user_alloc.c +4
-0@@ -30,6 +30,10 @@ static int kunit_attach_mm(void)if (current->mm)return 0 ; +/* arch_pick_mmap_layout() is only sane with MMU systems. */ +if (!IS_ENABLED (CONFIG_MMU )) +return -EINVAL ; + mm =mm_alloc ();if (!mm)return -ENOMEM ;lib/usercopy_kunit.c +5
-0@@ -290,6 +290,11 @@ static int usercopy_test_init(struct kunit *test)struct usercopy_test_priv *priv;unsigned long user_addr; +if (!IS_ENABLED (CONFIG_MMU )) { +kunit_skip (test,"Userspace allocation testing not available on non-MMU systems" ); +return 0 ; + } + priv =kunit_kzalloc (test,sizeof (*priv),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, priv); test->priv = priv;mm/util.c +2
-1@@ -484,7 +484,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) clear_bit(MMF_TOPDOWN, &mm->flags); }#endif +#ifdef CONFIG_MMU EXPORT_SYMBOL_IF_KUNIT (arch_pick_mmap_layout); +#endif /** * __account_locked_vm - account locked pages to an mm's locked_vm -- 2.34.1
Hi Shuah,
Can you please add this to your -next tree since it fixes test failures on non-MMU systems, after commit cf6219ee889f ("usercopy: Convert test_user_copy to KUnit test").
Thanks!
-Kees
Quoted 84 lines · Rae Moar
Quoted 7 lines · Kees Cook
Since
arch_pick_mmap_layout()is an inline for non-MMU systems, disable this test there.Reported-by kernel test robot <[email protected]>Signed-off-by Kees Cook <[email protected]>Hello!
This looks good to me. And seems to fix the problem. Thanks for the fix!
Reviewed-by Rae Moar <[email protected]>-Rae
Quoted 67 lines
---
Resending as v2 with Shuah in To:
---
Cc: Shuah Khan <[email protected]>
Cc: Brendan Higgins <[email protected]>
Cc: David Gow <[email protected]>
Cc: Rae Moar <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- lib/kunit/user_alloc.c | 4 ++++ lib/usercopy_kunit.c | 5 +++++ mm/util.c | 2 ++ 3 files changed, 11 insertions(+)lib/kunit/user_alloc.c +4
-0@@ -30,6 +30,10 @@ static int kunit_attach_mm(void)if (current->mm)return 0 ; +/* arch_pick_mmap_layout() is only sane with MMU systems. */ +if (!IS_ENABLED (CONFIG_MMU )) +return -EINVAL ; + mm =mm_alloc ();if (!mm)return -ENOMEM ;lib/usercopy_kunit.c +5
-0@@ -290,6 +290,11 @@ static int usercopy_test_init(struct kunit *test)struct usercopy_test_priv *priv;unsigned long user_addr; +if (!IS_ENABLED (CONFIG_MMU )) { +kunit_skip (test,"Userspace allocation testing not available on non-MMU systems" ); +return 0 ; + } + priv =kunit_kzalloc (test,sizeof (*priv),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, priv); test->priv = priv;mm/util.c +2
-1@@ -484,7 +484,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) clear_bit(MMF_TOPDOWN, &mm->flags); }#endif +#ifdef CONFIG_MMU EXPORT_SYMBOL_IF_KUNIT (arch_pick_mmap_layout); +#endif /** * __account_locked_vm - account locked pages to an mm's locked_vm -- 2.34.1
Signature · 1 line
Kees Cook
Quoted 7 lines · Kees Cook
Since
arch_pick_mmap_layout()is an inline for non-MMU systems, disable this test there.Reported-by kernel test robot <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 14 lines
---
Resending as v2 with Shuah in To:
---
Cc: Shuah Khan <[email protected]>
Cc: Brendan Higgins <[email protected]>
Cc: David Gow <[email protected]>
Cc: Rae Moar <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Cheers,
-- David
Shuah Khan
maintainerQuoted 23 lines · David Gow
Quoted 7 lines · Kees Cook
Since
arch_pick_mmap_layout()is an inline for non-MMU systems, disable this test there.Reported-by kernel test robot <[email protected]>Signed-off-by Kees Cook <[email protected]>Quoted 14 lines
---
Resending as v2 with Shuah in To:
---
Cc: Shuah Khan <[email protected]>
Cc: Brendan Higgins <[email protected]>
Cc: David Gow <[email protected]>
Cc: Rae Moar <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Quoted 4 lines
Reviewed-by David Gow <[email protected]>Cheers,
-- David
Thank you both. Applied to linux-kselftest kunit branch for next.
thanks,
-- Shuah
Shuah Khan
maintainerQuoted 6 lines · Kees Cook
Hi Shuah,
Can you please add this to your -next tree since it fixes test failures on non-MMU systems, after commit
cf6219ee889f("usercopy: Converttest_user_copyto KUnit test").
Applied to linux-kselftest kunit branch for next.
thanks,
-- Shuah