From: Nathan Chancellor <nathan@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: linux-hardening@vger.kernel.org, David Gow <davidgow@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fortify: Adjust KUnit test for modular build
Date: Tue, 13 Sep 2022 15:05:10 -0700 [thread overview]
Message-ID: <YyD+lu7Kq/Ga0N/V@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20220913173136.1926909-1-keescook@chromium.org>
On Tue, Sep 13, 2022 at 10:31:36AM -0700, Kees Cook wrote:
> A much better "unknown size" string pointer is available directly from
> struct test, so use that instead of a global that isn't shared with
> modules.
>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Link: https://lore.kernel.org/lkml/YyCOHOchVuE/E7vS@dev-arch.thelio-3990X
> Fixes: 875bfd5276f3 ("fortify: Add KUnit test for FORTIFY_SOURCE internals")
> Cc: linux-hardening@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Whoops! Thanks Nathan! :) This fixes it for your reproducer.
Confirmed :)
Build-tested-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the quick fix!
> ---
> lib/fortify_kunit.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/fortify_kunit.c b/lib/fortify_kunit.c
> index 99bc0ea60d27..409af07f340a 100644
> --- a/lib/fortify_kunit.c
> +++ b/lib/fortify_kunit.c
> @@ -17,7 +17,6 @@
>
> #include <kunit/test.h>
> #include <linux/string.h>
> -#include <linux/init.h>
>
> static const char array_of_10[] = "this is 10";
> static const char *ptr_of_11 = "this is 11!";
> @@ -31,7 +30,7 @@ static void known_sizes_test(struct kunit *test)
>
> KUNIT_EXPECT_EQ(test, __compiletime_strlen(array_unknown), SIZE_MAX);
> /* Externally defined and dynamically sized string pointer: */
> - KUNIT_EXPECT_EQ(test, __compiletime_strlen(saved_command_line), SIZE_MAX);
> + KUNIT_EXPECT_EQ(test, __compiletime_strlen(test->name), SIZE_MAX);
> }
>
> /* This is volatile so the optimizer can't perform DCE below. */
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-09-13 22:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 17:31 Kees Cook
2022-09-13 22:05 ` Nathan Chancellor [this message]
2022-09-14 10:13 ` David Gow
2022-09-14 13:59 ` 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=YyD+lu7Kq/Ga0N/V@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=davidgow@google.com \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®