]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: Taint the kernel when KUnit tests are run
authorDavid Gow <davidgow@google.com>
Fri, 1 Jul 2022 08:47:43 +0000 (16:47 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 1 Jul 2022 22:38:43 +0000 (16:38 -0600)
commit42a2a30eb80f87726b1f567402137f3a986739d3
treebe2fdab3f4a62d84254d8928ee3d06ce44a42576
parent4d65849fac90c14f52e7c5e2e9c62b997b142cc9
kunit: Taint the kernel when KUnit tests are run

Make KUnit trigger the new TAINT_TEST taint when any KUnit test is run.
Due to KUnit tests not being intended to run on production systems, and
potentially causing problems (or security issues like leaking kernel
addresses), the kernel's state should not be considered safe for
production use after KUnit tests are run.

This both marks KUnit modules as test modules using MODULE_INFO() and
manually taints the kernel when tests are run (which catches builtin
tests).

Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Tested-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: MaĆ­ra Canal <mairacanal@riseup.net>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
include/kunit/test.h
lib/kunit/test.c