devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] of: unittest: taint the kernel when of unittest runs
@ 2022-08-23 20:01 frowand.list
  2022-08-25 18:59 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: frowand.list @ 2022-08-23 20:01 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

Make OF unittest trigger the new TAINT_TEST taint when OF unittest runs.
Due to OF unittest 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 OF unittest runs.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---

Follow the precedent set by KUnit tests in v6.0-rc1:
  commit c272612cb4a2 ("kunit: Taint the kernel when KUnit tests are run")
  commit 2852ca7fba9f ("panic: Taint kernel if tests are run")

 drivers/of/unittest.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index eafa8ffefbd0..4f8cc1b21ac4 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -3467,6 +3467,9 @@ static int __init of_unittest(void)
 
 	pr_info("start of unittest - you will see error messages\n");
 
+	/* Taint the kernel so we know we've run tests. */
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
+
 	/* adding data for unittest */
 
 	if (IS_ENABLED(CONFIG_UML))
-- 
Frank Rowand <frank.rowand@sony.com>


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

* Re: [PATCH 1/1] of: unittest: taint the kernel when of unittest runs
  2022-08-23 20:01 [PATCH 1/1] of: unittest: taint the kernel when of unittest runs frowand.list
@ 2022-08-25 18:59 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2022-08-25 18:59 UTC (permalink / raw)
  To: frowand.list; +Cc: Rob Herring, linux-kernel, devicetree

On Tue, 23 Aug 2022 15:01:52 -0500, frowand.list@gmail.com wrote:
> From: Frank Rowand <frank.rowand@sony.com>
> 
> Make OF unittest trigger the new TAINT_TEST taint when OF unittest runs.
> Due to OF unittest 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 OF unittest runs.
> 
> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> ---
> 
> Follow the precedent set by KUnit tests in v6.0-rc1:
>   commit c272612cb4a2 ("kunit: Taint the kernel when KUnit tests are run")
>   commit 2852ca7fba9f ("panic: Taint kernel if tests are run")
> 
>  drivers/of/unittest.c | 3 +++
>  1 file changed, 3 insertions(+)
> 

Applied, thanks!

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

end of thread, other threads:[~2022-08-25 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 20:01 [PATCH 1/1] of: unittest: taint the kernel when of unittest runs frowand.list
2022-08-25 18:59 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).