LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Frank Rowand <frowand.list@gmail.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	robh+dt@kernel.org, kernel-team@android.com
Subject: Re: [PATCH] of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
Date: Mon, 23 Aug 2021 09:04:20 +0100	[thread overview]
Message-ID: <87eeakr3i3.wl-maz@kernel.org> (raw)
In-Reply-To: <a67743f9-869b-28df-d714-db15da4ebe06@gmail.com>

Hi Frank,

On Mon, 23 Aug 2021 05:01:15 +0100,
Frank Rowand <frowand.list@gmail.com> wrote:
> 
> Hi Marc,
> 
> On 8/20/21 9:47 AM, Marc Zyngier wrote:
> > Trying to boot without SYSFS, but with OF_DYNAMIC quickly
> > results in a crash:
> > 
> > [    0.088460] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
> > [...]
> > [    0.103927] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc3 #4179
> > [    0.105810] Hardware name: linux,dummy-virt (DT)
> > [    0.107147] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
> > [    0.108876] pc : kernfs_find_and_get_ns+0x3c/0x7c
> > [    0.110244] lr : kernfs_find_and_get_ns+0x3c/0x7c
> > [...]
> > [    0.134087] Call trace:
> > [    0.134800]  kernfs_find_and_get_ns+0x3c/0x7c
> > [    0.136054]  safe_name+0x4c/0xd0
> > [    0.136994]  __of_attach_node_sysfs+0xf8/0x124
> > [    0.138287]  of_core_init+0x90/0xfc
> > [    0.139296]  driver_init+0x30/0x4c
> > [    0.140283]  kernel_init_freeable+0x160/0x1b8
> > [    0.141543]  kernel_init+0x30/0x140
> > [    0.142561]  ret_from_fork+0x10/0x18
> > 
> > While not having sysfs isn't a very common option these days,
> > it is still expected that such configuration would work.
> > 
> > Paper over it by bailing out from __of_attach_node_sysfs() if
> > CONFIG_SYSFS isn't enabled.
> 
> CONFIG_SYSFS should be automatically selected when CONFIG_OF_DYNAMIC
> is enabled, and it should not be possible to disable CONFIG_SYSFS
> in this case.

OF_DYNAMIC selects OF_KOBJ, which itself doesn't actually depends on
SYSFS. It merely has a "def_bool SYSFS". If a stronger dependency is
expected, that's probably where it should be expressed.

However, kobj.c already has a couple of

	if (!IS_ENABLED(CONFIG_SYSFS))
		return 0;

sprinkled over it, so there is already an assumption that it can be
build without SYSFS.

> 
> Can you send your .config?

https://pastebin.com/MmRWuxLr

> What ARCH did you build the kernel with?

That's an arm64 build.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2021-08-23  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 14:47 Marc Zyngier
2021-08-23  4:01 ` Frank Rowand
2021-08-23  8:04   ` Marc Zyngier [this message]
2021-08-23 18:46   ` Rob Herring
2021-08-23 21:27     ` Frank Rowand
2021-08-23 22:14       ` Rob Herring
2021-08-23 22:21         ` Frank Rowand
2021-08-23 18:48 ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeakr3i3.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH] of: Don'\''t allow __of_attached_node_sysfs() without CONFIG_SYSFS' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).