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: <bcb2e89f-9768-8435-35d9-d02140628b9a@gmail.com>
Date:   Mon, 23 Aug 2021 16:27:08 -0500
From:   Frank Rowand <frowand.list@...il.com>
To:     Rob Herring <robh@...nel.org>
Cc:     Marc Zyngier <maz@...nel.org>, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH] of: Don't allow __of_attached_node_sysfs() without
 CONFIG_SYSFS

On 8/23/21 1:46 PM, Rob Herring wrote:
> On Sun, Aug 22, 2021 at 11:01:15PM -0500, Frank Rowand 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.
> 
> That used to be true, but isn't now.

OK.  I agree with you, but when I investigated the original patch
email I came to a different conclusion because of the way that I
used make menuconfig to debug the situation.

It is true when I start with a .config created from 'make qcom_defconfig',
then select OF_UNITTEST, which is the only way I can see OF_DYNAMIC.  It
is the "if OF_UNITTEST" that means SYSFS can not be disabled.

If I start with the .config that Marc supplied, then make menuconfig
still does not show the OC_DYNAMIC option, but leaves it set since
it was already set.  In this case SYSFS remains disabled because
OF_UNITTEST is also disabled.

Using '/OF_DYNAMIC' from within make menuconfig, to get more info
about OF_DYNAMIC tells me that the prompt for OF_DYNAMIC is visible
if OF && OF_UNITTEST.  This is due to the "if OF_UNITTEST" in line 58
of drivers/of/Kconfig in the OF_DYNAMIC specification.

Thus I can't figure out how to use make menuconfig to set OF_DYNAMIC
without setting OF_UNITTEST.  I tried setting OF_UNITTEST, then setting
OF_DYNAMIC, saving the changes, then another make menuconfig to
disable OF_UNITTEST, which then has the side effect of unsetting
OF_DYNAMIC.

Would you accept a patch that removes the "if OF_UNITTEST" from
the Kconfig entry for OF_DYNAMIC?

-Frank

> 
> Rob
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ