lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+GJov5ZpFxKxK44SAb_B8SzWUF9uQV13A8BcVPijo0CV0mStg@mail.gmail.com>
Date: Thu, 20 Jun 2024 17:13:35 -0400
From: Rae Moar <rmoar@...gle.com>
To: Kees Cook <kees@...nel.org>
Cc: Shuah Khan <skhan@...uxfoundation.org>, kernel test robot <lkp@...el.com>, 
	Brendan Higgins <brendan.higgins@...ux.dev>, David Gow <davidgow@...gle.com>, 
	"Gustavo A. R. Silva" <gustavoars@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, 
	linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com, 
	linux-hardening@...r.kernel.org, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kunit/usercopy: Disable testing on !CONFIG_MMU

On Wed, Jun 19, 2024 at 4:25 PM Kees Cook <kees@...nel.org> wrote:
>
> Since arch_pick_mmap_layout() is an inline for non-MMU systems, disable
> this test there.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202406160505.uBge6TMY-lkp@intel.com/
> Signed-off-by: Kees Cook <kees@...nel.org>

Hello!

This looks good to me. And seems to fix the problem. Thanks for the fix!

Reviewed-by: Rae Moar <rmoar@...gle.com>

-Rae

> ---
> Resending as v2 with Shuah in To:
> ---
> Cc: Shuah Khan <skhan@...uxfoundation.org>
> Cc: Brendan Higgins <brendan.higgins@...ux.dev>
> Cc: David Gow <davidgow@...gle.com>
> Cc: Rae Moar <rmoar@...gle.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: linux-kselftest@...r.kernel.org
> Cc: kunit-dev@...glegroups.com
> Cc: linux-hardening@...r.kernel.org
> Cc: linux-mm@...ck.org
> ---
>  lib/kunit/user_alloc.c | 4 ++++
>  lib/usercopy_kunit.c   | 5 +++++
>  mm/util.c              | 2 ++
>  3 files changed, 11 insertions(+)
>
> diff --git a/lib/kunit/user_alloc.c b/lib/kunit/user_alloc.c
> index 76d3d1345ed7..ae935df09a5e 100644
> --- a/lib/kunit/user_alloc.c
> +++ b/lib/kunit/user_alloc.c
> @@ -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;
> diff --git a/lib/usercopy_kunit.c b/lib/usercopy_kunit.c
> index 45f1e558c464..e819561a540d 100644
> --- a/lib/usercopy_kunit.c
> +++ b/lib/usercopy_kunit.c
> @@ -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;
> diff --git a/mm/util.c b/mm/util.c
> index df37c47d9374..e70e8e439258 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ