* [PATCH] kunit: test: Use an action wrapper instead of a cast
@ 2023-12-06 8:22 David Gow
2023-12-08 19:32 ` Rae Moar
0 siblings, 1 reply; 2+ messages in thread
From: David Gow @ 2023-12-06 8:22 UTC (permalink / raw)
To: Rae Moar, Shuah Khan
Cc: David Gow, kunit-dev, Brendan Higgins, linux-kselftest,
linux-kernel
We missed one of the casts of kfree() to kunit_action_t in kunit-test,
which was only enabled when debugfs was in use. This could potentially
break CFI.
Use the existing wrapper function instead.
Signed-off-by: David Gow <davidgow@google.com>
---
lib/kunit/kunit-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
index 3e9c5192d095..ee6927c60979 100644
--- a/lib/kunit/kunit-test.c
+++ b/lib/kunit/kunit-test.c
@@ -559,7 +559,7 @@ static void kunit_log_test(struct kunit *test)
KUNIT_EXPECT_TRUE(test, test->log->append_newlines);
full_log = string_stream_get_string(test->log);
- kunit_add_action(test, (kunit_action_t *)kfree, full_log);
+ kunit_add_action(test, kfree_wrapper, full_log);
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
strstr(full_log, "put this in log."));
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
--
2.43.0.rc2.451.g8631bc7472-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kunit: test: Use an action wrapper instead of a cast
2023-12-06 8:22 [PATCH] kunit: test: Use an action wrapper instead of a cast David Gow
@ 2023-12-08 19:32 ` Rae Moar
0 siblings, 0 replies; 2+ messages in thread
From: Rae Moar @ 2023-12-08 19:32 UTC (permalink / raw)
To: David Gow
Cc: Shuah Khan, kunit-dev, Brendan Higgins, linux-kselftest,
linux-kernel
On Wed, Dec 6, 2023 at 3:23 AM David Gow <davidgow@google.com> wrote:
>
> We missed one of the casts of kfree() to kunit_action_t in kunit-test,
> which was only enabled when debugfs was in use. This could potentially
> break CFI.
>
> Use the existing wrapper function instead.
>
> Signed-off-by: David Gow <davidgow@google.com>
Hello!
This looks good to me. All ready to go.
Reviewed-by: Rae Moar <rmoar@google.com>
Thanks!
-Rae
> ---
> lib/kunit/kunit-test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
> index 3e9c5192d095..ee6927c60979 100644
> --- a/lib/kunit/kunit-test.c
> +++ b/lib/kunit/kunit-test.c
> @@ -559,7 +559,7 @@ static void kunit_log_test(struct kunit *test)
> KUNIT_EXPECT_TRUE(test, test->log->append_newlines);
>
> full_log = string_stream_get_string(test->log);
> - kunit_add_action(test, (kunit_action_t *)kfree, full_log);
> + kunit_add_action(test, kfree_wrapper, full_log);
> KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
> strstr(full_log, "put this in log."));
> KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
> --
> 2.43.0.rc2.451.g8631bc7472-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-08 19:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 8:22 [PATCH] kunit: test: Use an action wrapper instead of a cast David Gow
2023-12-08 19:32 ` Rae Moar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox