mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kcsan: remove rng selftest
@ 2022-10-17  4:43 Jason A. Donenfeld
  2022-10-17  5:07 ` Marco Elver
  0 siblings, 1 reply; 4+ messages in thread
From: Jason A. Donenfeld @ 2022-10-17  4:43 UTC (permalink / raw)
  To: elver, dvyukov, kasan-dev, linux-kernel; +Cc: Jason A. Donenfeld

The first test of the kcsan selftest appears to test if get_random_u32()
returns two zeros in a row, and requires that it doesn't. This seems
like a bogus critera. Remove it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 kernel/kcsan/selftest.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/kernel/kcsan/selftest.c b/kernel/kcsan/selftest.c
index 00cdf8fa5693..1740ce389e7f 100644
--- a/kernel/kcsan/selftest.c
+++ b/kernel/kcsan/selftest.c
@@ -22,13 +22,6 @@
 
 #define ITERS_PER_TEST 2000
 
-/* Test requirements. */
-static bool __init test_requires(void)
-{
-	/* random should be initialized for the below tests */
-	return get_random_u32() + get_random_u32() != 0;
-}
-
 /*
  * Test watchpoint encode and decode: check that encoding some access's info,
  * and then subsequent decode preserves the access's info.
@@ -259,7 +252,6 @@ static int __init kcsan_selftest(void)
 			pr_err("selftest: " #do_test " failed");               \
 	} while (0)
 
-	RUN_TEST(test_requires);
 	RUN_TEST(test_encode_decode);
 	RUN_TEST(test_matching_access);
 	RUN_TEST(test_barrier);
-- 
2.37.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kcsan: remove rng selftest
  2022-10-17  4:43 [PATCH] kcsan: remove rng selftest Jason A. Donenfeld
@ 2022-10-17  5:07 ` Marco Elver
  2022-10-17  5:08   ` Marco Elver
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Elver @ 2022-10-17  5:07 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: dvyukov, kasan-dev, linux-kernel

On Sun, 16 Oct 2022 at 21:43, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> The first test of the kcsan selftest appears to test if get_random_u32()
> returns two zeros in a row, and requires that it doesn't. This seems
> like a bogus critera. Remove it.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Acked-by: Marco Elver <elver@google.com>

Looks pretty redundant at this point (I think some early version had
it because somehow I managed to run the test too early and wanted to
avoid that accidentally happening again).

> ---
>  kernel/kcsan/selftest.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/kernel/kcsan/selftest.c b/kernel/kcsan/selftest.c
> index 00cdf8fa5693..1740ce389e7f 100644
> --- a/kernel/kcsan/selftest.c
> +++ b/kernel/kcsan/selftest.c
> @@ -22,13 +22,6 @@
>
>  #define ITERS_PER_TEST 2000
>
> -/* Test requirements. */
> -static bool __init test_requires(void)
> -{
> -       /* random should be initialized for the below tests */
> -       return get_random_u32() + get_random_u32() != 0;
> -}
> -
>  /*
>   * Test watchpoint encode and decode: check that encoding some access's info,
>   * and then subsequent decode preserves the access's info.
> @@ -259,7 +252,6 @@ static int __init kcsan_selftest(void)
>                         pr_err("selftest: " #do_test " failed");               \
>         } while (0)
>
> -       RUN_TEST(test_requires);
>         RUN_TEST(test_encode_decode);
>         RUN_TEST(test_matching_access);
>         RUN_TEST(test_barrier);
> --
> 2.37.3
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kcsan: remove rng selftest
  2022-10-17  5:07 ` Marco Elver
@ 2022-10-17  5:08   ` Marco Elver
  2022-10-17 17:26     ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Elver @ 2022-10-17  5:08 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: dvyukov, kasan-dev, linux-kernel

On Sun, 16 Oct 2022 at 22:07, Marco Elver <elver@google.com> wrote:
>
> On Sun, 16 Oct 2022 at 21:43, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > The first test of the kcsan selftest appears to test if get_random_u32()
> > returns two zeros in a row, and requires that it doesn't. This seems
> > like a bogus critera. Remove it.
> >
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
>
> Acked-by: Marco Elver <elver@google.com>
>
> Looks pretty redundant at this point (I think some early version had
> it because somehow I managed to run the test too early and wanted to
> avoid that accidentally happening again).
>

And kindly queue it in your tree with all the rng related changes. Thanks!

> > ---
> >  kernel/kcsan/selftest.c | 8 --------
> >  1 file changed, 8 deletions(-)
> >
> > diff --git a/kernel/kcsan/selftest.c b/kernel/kcsan/selftest.c
> > index 00cdf8fa5693..1740ce389e7f 100644
> > --- a/kernel/kcsan/selftest.c
> > +++ b/kernel/kcsan/selftest.c
> > @@ -22,13 +22,6 @@
> >
> >  #define ITERS_PER_TEST 2000
> >
> > -/* Test requirements. */
> > -static bool __init test_requires(void)
> > -{
> > -       /* random should be initialized for the below tests */
> > -       return get_random_u32() + get_random_u32() != 0;
> > -}
> > -
> >  /*
> >   * Test watchpoint encode and decode: check that encoding some access's info,
> >   * and then subsequent decode preserves the access's info.
> > @@ -259,7 +252,6 @@ static int __init kcsan_selftest(void)
> >                         pr_err("selftest: " #do_test " failed");               \
> >         } while (0)
> >
> > -       RUN_TEST(test_requires);
> >         RUN_TEST(test_encode_decode);
> >         RUN_TEST(test_matching_access);
> >         RUN_TEST(test_barrier);
> > --
> > 2.37.3
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kcsan: remove rng selftest
  2022-10-17  5:08   ` Marco Elver
@ 2022-10-17 17:26     ` Jason A. Donenfeld
  0 siblings, 0 replies; 4+ messages in thread
From: Jason A. Donenfeld @ 2022-10-17 17:26 UTC (permalink / raw)
  To: Marco Elver; +Cc: dvyukov, kasan-dev, linux-kernel

On Sun, Oct 16, 2022 at 11:09 PM Marco Elver <elver@google.com> wrote:
>
> On Sun, 16 Oct 2022 at 22:07, Marco Elver <elver@google.com> wrote:
> >
> > On Sun, 16 Oct 2022 at 21:43, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> > >
> > > The first test of the kcsan selftest appears to test if get_random_u32()
> > > returns two zeros in a row, and requires that it doesn't. This seems
> > > like a bogus critera. Remove it.
> > >
> > > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> >
> > Acked-by: Marco Elver <elver@google.com>
> >
> > Looks pretty redundant at this point (I think some early version had
> > it because somehow I managed to run the test too early and wanted to
> > avoid that accidentally happening again).
> >
>
> And kindly queue it in your tree with all the rng related changes. Thanks!

Okay sure, will do.

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-17 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17  4:43 [PATCH] kcsan: remove rng selftest Jason A. Donenfeld
2022-10-17  5:07 ` Marco Elver
2022-10-17  5:08   ` Marco Elver
2022-10-17 17:26     ` Jason A. Donenfeld

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®