From: Shuah Khan <skhan@linuxfoundation.org>
To: Kees Cook <kees@kernel.org>, Mark Rutland <mark.rutland@arm.com>
Cc: Vitor Massaru Iha <vitor@massaru.org>,
Ivan Orlov <ivan.orlov0322@gmail.com>,
David Gow <davidgow@google.com>,
Brendan Higgins <brendan.higgins@linux.dev>,
Rae Moar <rmoar@google.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-hardening@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3 2/2] usercopy: Convert test_user_copy to KUnit test
Date: Fri, 14 Jun 2024 09:50:05 -0600 [thread overview]
Message-ID: <90e61842-e933-4d6f-a3b5-c802382fe96a@linuxfoundation.org> (raw)
In-Reply-To: <20240612195921.2685842-2-kees@kernel.org>
On 6/12/24 13:59, Kees Cook wrote:
> Convert the runtime tests of hardened usercopy to standard KUnit tests.
>
> Additionally disable usercopy_test_invalid() for systems with separate
> address spaces (or no MMU) since it's not sensible to test for address
> confusion there (e.g. m68k).
>
> Co-developed-by: Vitor Massaru Iha <vitor@massaru.org>
> Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
> Link: https://lore.kernel.org/r/20200721174654.72132-1-vitor@massaru.org
> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
> Reviewed-by: David Gow <davidgow@google.com>
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
> MAINTAINERS | 1 +
> lib/Kconfig.debug | 21 +-
> lib/Makefile | 2 +-
> lib/{test_user_copy.c => usercopy_kunit.c} | 282 ++++++++++-----------
> 4 files changed, 151 insertions(+), 155 deletions(-)
> rename lib/{test_user_copy.c => usercopy_kunit.c} (46%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8754ac2c259d..0cd171ec6010 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11962,6 +11962,7 @@ F: arch/*/configs/hardening.config
> F: include/linux/overflow.h
> F: include/linux/randomize_kstack.h
> F: kernel/configs/hardening.config
> +F: lib/usercopy_kunit.c
> F: mm/usercopy.c
> K: \b(add|choose)_random_kstack_offset\b
> K: \b__check_(object_size|heap_object)\b
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 59b6765d86b8..561e346f5cb0 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -2505,18 +2505,6 @@ config TEST_VMALLOC
>
> If unsure, say N.
>
> -config TEST_USER_COPY
> - tristate "Test user/kernel boundary protections"
> - depends on m
> - help
> - This builds the "test_user_copy" module that runs sanity checks
> - on the copy_to/from_user infrastructure, making sure basic
> - user/kernel boundary testing is working. If it fails to load,
> - a regression has been detected in the user/kernel memory boundary
> - protections.
> -
> - If unsure, say N.
> -
> config TEST_BPF
> tristate "Test BPF filter functionality"
> depends on m && NET
> @@ -2814,6 +2802,15 @@ config SIPHASH_KUNIT_TEST
> This is intended to help people writing architecture-specific
> optimized versions. If unsure, say N.
>
> +config USERCOPY_KUNIT_TEST
> + tristate "KUnit Test for user/kernel boundary protections"
> + depends on KUNIT
> + default KUNIT_ALL_TESTS
> + help
> + This builds the "usercopy_kunit" module that runs sanity checks
> + on the copy_to/from_user infrastructure, making sure basic
> + user/kernel boundary testing is working.
> +
Please carry the following line forward as well to be complete assuming
it is relevant.
If unsure, say N.
thanks,
-- Shuah
next prev parent reply other threads:[~2024-06-14 15:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 19:59 [PATCH v3 0/2] " Kees Cook
2024-06-12 19:59 ` [PATCH v3 1/2] kunit: test: Add vm_mmap() allocation resource manager Kees Cook
2024-06-22 13:47 ` Guenter Roeck
2024-06-27 19:51 ` Kees Cook
2024-06-12 19:59 ` [PATCH v3 2/2] usercopy: Convert test_user_copy to KUnit test Kees Cook
2024-06-14 15:50 ` Shuah Khan [this message]
2024-06-17 19:00 ` Kees Cook
2024-06-17 19:17 ` Shuah Khan
2024-06-19 18:38 ` Jeff Johnson
2024-06-19 20:35 ` Kees Cook
2024-06-13 4:41 ` [PATCH v3 0/2] " David Gow
2024-06-13 5:03 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90e61842-e933-4d6f-a3b5-c802382fe96a@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=gustavoars@kernel.org \
--cc=ivan.orlov0322@gmail.com \
--cc=kees@kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rmoar@google.com \
--cc=vitor@massaru.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome