lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <171388470076.215446.15104256542666415343.robh@kernel.org>
Date: Tue, 23 Apr 2024 10:05:30 -0500
From: Rob Herring <robh@...nel.org>
To: Stephen Boyd <sboyd@...nel.org>
Cc: Maxime Ripard <maxime@...no.tech>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Brendan Higgins <brendan.higgins@...ux.dev>,
	Rae Moar <rmoar@...gle.com>, linux-kselftest@...r.kernel.org,
	David Gow <davidgow@...gle.com>,
	Christian Marangi <ansuelsmth@...il.com>,
	linux-kernel@...r.kernel.org,
	"Rafael J . Wysocki" <rafael@...nel.org>,
	kunit-dev@...glegroups.com, patches@...ts.linux.dev,
	linux-clk@...r.kernel.org,
	Michael Turquette <mturquette@...libre.com>,
	Saravana Kannan <saravanak@...gle.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Daniel Latypov <dlatypov@...gle.com>, devicetree@...r.kernel.org
Subject: Re: [PATCH v4 01/10] of: Add test managed wrappers for
 of_overlay_apply()/of_node_put()


On Mon, 22 Apr 2024 16:23:54 -0700, Stephen Boyd wrote:
> Add test managed wrappers for of_overlay_apply() that automatically
> removes the overlay when the test is finished. This API is intended for
> use by KUnit tests that test code which relies on 'struct device_node's
> and of_*() APIs.
> 
> KUnit tests will call of_overlay_apply_kunit() to load an overlay that's
> been built into the kernel image. When the test is complete, the overlay
> will be removed.
> 
> This has a few benefits:
> 
>  1) It keeps the tests hermetic because the overlay is removed when the
>     test is complete. Tests won't even be aware that an overlay was
>     loaded in another test.
> 
>  2) The overlay code can live right next to the unit test that loads it.
>     The overlay and the unit test can be compiled into one kernel module
>     if desired.
> 
>  3) We can test different device tree configurations by loading
>     different overlays. The overlays can be written for a specific test,
>     and there can be many of them loaded per-test without needing to jam
>     all possible combinations into one DTB.
> 
>  4) It also allows KUnit to test device tree dependent code on any
>     architecture, not just UML. This allows KUnit tests to test
>     architecture specific device tree code.
> 
> There are some potential pitfalls though. Test authors need to be
> careful to not overwrite properties in the live tree. The easiest way to
> do this is to add and remove nodes with a 'kunit-' prefix, almost
> guaranteeing that the same node won't be present in the tree loaded at
> boot.
> 
> Suggested-by: Rob Herring <robh@...nel.org>
> Cc: Rob Herring <robh@...nel.org>
> Cc: Saravana Kannan <saravanak@...gle.com>
> Signed-off-by: Stephen Boyd <sboyd@...nel.org>
> ---
>  Documentation/dev-tools/kunit/api/index.rst | 11 +++
>  Documentation/dev-tools/kunit/api/of.rst    | 13 +++
>  drivers/of/Makefile                         |  1 +
>  drivers/of/of_kunit.c                       | 99 +++++++++++++++++++++
>  include/kunit/of.h                          | 94 +++++++++++++++++++
>  5 files changed, 218 insertions(+)
>  create mode 100644 Documentation/dev-tools/kunit/api/of.rst
>  create mode 100644 drivers/of/of_kunit.c
>  create mode 100644 include/kunit/of.h
> 

Reviewed-by: Rob Herring (Arm) <robh@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ