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: <CAL_JsqLrRXdPZ+u9XG960V7sXECBi5Ko7BYdreftYz-O=Hwieg@mail.gmail.com>
Date: Tue, 13 Feb 2024 17:52:00 +0000
From: Rob Herring <robh+dt@...nel.org>
To: Stephen Boyd <sboyd@...nel.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>, David Gow <davidgow@...gle.com>, 
	linux-kernel@...r.kernel.org, patches@...ts.linux.dev, 
	linux-um@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org, 
	kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org, 
	devicetree@...r.kernel.org, Frank Rowand <frowand.list@...il.com>, 
	Brendan Higgins <brendan.higgins@...ux.dev>
Subject: Re: [PATCH v3 7/7] of: Add KUnit test to confirm DTB is loaded

On Fri, Feb 9, 2024 at 8:59 PM Stephen Boyd <sboyd@...nel.org> wrote:
>
> Quoting Geert Uytterhoeven (2024-02-05 11:55:29)
> > On Mon, Feb 5, 2024 at 8:19 PM Stephen Boyd <sboyd@...nel.org> wrote:
> > > Quoting David Gow (2024-02-02 20:10:17)
> > > > On Sat, 3 Feb 2024 at 03:59, Stephen Boyd <sboyd@...nel.org> wrote:
> > > > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a
> > > > > root node, and that the of_have_populated_dt() API works properly.
> > > > >
> > > > > Cc: Rob Herring <robh+dt@...nel.org>
> > > > > Cc: Frank Rowand <frowand.list@...il.com>
> > > > > Cc: David Gow <davidgow@...gle.com>
> > > > > Cc: Brendan Higgins <brendan.higgins@...ux.dev>
> > > > > Signed-off-by: Stephen Boyd <sboyd@...nel.org>
> > > > > ---
> > > >
> > > > This looks pretty good to me test-wise, though it still fails on m68k.
> > > > (Everything else I tried it on works, though I've definitely not tried
> > > > _every_ architecture.)
> > > >
> > > > aarch64: PASSED
> > > > i386: PASSED
> > > > x86_64: PASSED
> > > > x86_64 KASAN: PASSED
> > > > powerpc64: PASSED
> > > > UML: PASSED
> > > > UML LLVM: PASSED
> > > > m68k: FAILED
> > > > > $ qemu-system-m68k -nodefaults -m 1024 -kernel .kunit-all-m68k/vmlinux -append 'kunit.enable=1 console=hvc0 kunit_shutdown=reboot' -no-reboot -nographic -serial stdio -machine virt
> > > > > [11:55:05] ===================== dtb (2 subtests) =====================
> > > > > [11:55:05] # dtb_root_node_found_by_path: EXPECTATION FAILED at drivers/of/of_test.c:18
> > > > > [11:55:05] Expected np is not null, but is
> > > > > [11:55:05] [FAILED] dtb_root_node_found_by_path
> > > > > [11:55:05] # dtb_root_node_populates_of_root: EXPECTATION FAILED at drivers/of/of_test.c:28
> > > > > [11:55:05] Expected of_root is not null, but is
> > > > > [11:55:05] [FAILED] dtb_root_node_populates_of_root
> > > > > [11:55:05]     # module: of_test
> > > > > [11:55:05] # dtb: pass:0 fail:2 skip:0 total:2
> > > > > [11:55:05] # Totals: pass:0 fail:2 skip:0 total:2
> > > > > [11:55:05] ======================= [FAILED] dtb =======================
> > >
> > > Ah yeah I forgot to mention that. m68k fails because it doesn't call the
> > > unflatten_(and_copy)?_device_tree() function, so we don't populate a
> > > root node on that architecture. One solution would be to make CONFIG_OF
> > > unavailable on m68k. Or we have to make sure DT works on any
> > > architecture. Rob, what do you prefer here?
> >
> > I guess the latter?
> > Alpha, hexagon, parisc, s390, and sparc are also lacking calls
> > to unflatten.*device_tree().
> >
>
> sparc does that on purpose. Perhaps it's simplest to call
> unflatten_device_tree() if of_root is still NULL after setup_arch()
> returns.
>
> ---8<---
> diff --git a/init/main.c b/init/main.c
> index e24b0780fdff..02f5cf8be6c1 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -97,6 +97,8 @@
>  #include <linux/jump_label.h>
>  #include <linux/kcsan.h>
>  #include <linux/init_syscalls.h>
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
>  #include <linux/stackdepot.h>
>  #include <linux/randomize_kstack.h>
>  #include <net/net_namespace.h>
> @@ -895,6 +897,8 @@ void start_kernel(void)
>         pr_notice("%s", linux_banner);
>         early_security_init();
>         setup_arch(&command_line);
> +       if (!of_root)

of_root is another thing I'd like to remove direct access to. That
check could be inside unflatten_device_tree().

> +               unflatten_device_tree();

That's back to what Frank had essentially and I wanted to avoid.

I think I'd just disable the tests on the above arches and let them
opt-in. I could be convinced otherwise though.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ