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: <a0c3e6d4-2827-d9b4-8f4e-aef25997fa8a@digikod.net>
Date:   Mon, 29 May 2023 16:57:11 +0200
From:   Mickaël Salaün <mic@...ikod.net>
To:     Richard Weinberger <richard@....at>
Cc:     anton ivanov <anton.ivanov@...bridgegreys.com>,
        Johannes Berg <johannes@...solutions.net>,
        Christopher Obbard <chris.obbard@...labora.com>,
        Guenter Roeck <groeck@...omium.org>,
        Günther Noack <gnoack3000@...il.com>,
        kuba <kuba@...nel.org>, James Morris <jmorris@...ei.org>,
        Jeff Xu <jeffxu@...gle.com>, Kees Cook <keescook@...omium.org>,
        Paul Moore <paul@...l-moore.com>,
        Ritesh Raj Sarraf <ritesh@...labora.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Sjoerd Simons <sjoerd@...labora.com>,
        Willem de Bruijn <willemb@...gle.com>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-kselftest <linux-kselftest@...r.kernel.org>,
        LSM <linux-security-module@...r.kernel.org>,
        stable <stable@...r.kernel.org>
Subject: Re: [PATCH v1 1/5] hostfs: Fix ephemeral inodes


On 26/05/2023 18:40, Mickaël Salaün wrote:
> 
> On 21/05/2023 23:13, Richard Weinberger wrote:
>> ----- Ursprüngliche Mail -----
>>> Von: "Mickaël Salaün" <mic@...ikod.net>
>>> hostfs creates a new inode for each opened or created file, which created
>>> useless inode allocations and forbade identifying a host file with a kernel
>>> inode.
>>>
>>> Fix this uncommon filesystem behavior by tying kernel inodes to host
>>> file's inode and device IDs.  Even if the host filesystem inodes may be
>>> recycled, this cannot happen while a file referencing it is open, which
>>> is the case with hostfs.  It should be noted that hostfs inode IDs may
>>> not be unique for the same hostfs superblock because multiple host's
>>> (backed) superblocks may be used.
>>>
>>> Delete inodes when dropping them to force backed host's file descriptors
>>> closing.
>>>
>>> This enables to entirely remove ARCH_EPHEMERAL_INODES, and then makes
>>> Landlock fully supported by UML.  This is very useful for testing
>>> (ongoing and backported) changes.
>>
>> Removing ARCH_EPHEMERAL_INODES should be a patch on its own, IMHO.
> 
> OK, I'll do that in the next series.

Well, I added ARCH_EPHEMERAL_INODES for Landlock specifically because of 
this hostfs inconsistency, and it is not used by anything else in the 
kernel: https://git.kernel.org/torvalds/c/cb2c7d1a1776
I then think it makes sense to remove this Kconfig option with the 
hostfs change. Moreover, this protects against erroneously backporting 
the ARCH_EPHEMERAL_INODES change, which would silently introduce a bug 
for Landlock.


> 
>>
>>> These changes also factor out and simplify some helpers thanks to the
>>> new hostfs_inode_update() and the hostfs_iget() revamp: read_name(),
>>> hostfs_create(), hostfs_lookup(), hostfs_mknod(), and
>>> hostfs_fill_sb_common().
>>>
>>> A following commit with new Landlock tests check this new hostfs inode
>>> consistency.
>>>
>>> Cc: Anton Ivanov <anton.ivanov@...bridgegreys.com>
>>> Cc: Johannes Berg <johannes@...solutions.net>
>>> Cc: Richard Weinberger <richard@....at>
>>> Cc: <stable@...r.kernel.org> # 5.15.x: ce72750f04d6: hostfs: Fix writeback of
>>> dirty pages
>>> Cc: <stable@...r.kernel.org> # 5.15+
>>
>> I'm not sure whether this patch qualifies as stable material.
>> While I fully agree that the current behavoir is odd, nothing user visible
>> is really broken so far.
> I added the ARCH_EPHEMERAL_INODES knob to avoid unexpected behavior.
> Thanks to that there is no regression for Landlock, but it's unfortunate
> that we could not use UML to test old kernel versions. According to this
> odd behavior, I guess some user space may not work with hostfs because
> of this issue, hence this Cc. I can remove it if you think it is not the
> case.
> 
> 
>>
>>> Signed-off-by: Mickaël Salaün <mic@...ikod.net>
>>> Link: https://lore.kernel.org/r/20230309165455.175131-2-mic@digikod.net
>>
>> Other than that, patch looks good to me.
> 
> Good, I'll send a new series with your suggestions.

Can I add your Signed-off-by to this patch (without touching 
ARCH_EPHEMERAL_INODES changes, but removing the Cc stable)?

Are you OK for me to push this patch (with the whole series) in the 
Landlock and next tree?

I'll send a new series splitting the Landlock tests to make a patch 
dedicated to Landlock with hostfs tests (not backported), and with 
another patch containing backportable and independent new Landlock FS tests.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ