All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: Richard Weinberger <richard@nod.at>
Cc: "anton ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Christopher Obbard" <chris.obbard@collabora.com>,
	"Guenter Roeck" <groeck@chromium.org>,
	"Günther Noack" <gnoack3000@gmail.com>, kuba <kuba@kernel.org>,
	"James Morris" <jmorris@namei.org>, "Jeff Xu" <jeffxu@google.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Paul Moore" <paul@paul-moore.com>,
	"Ritesh Raj Sarraf" <ritesh@collabora.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Sjoerd Simons" <sjoerd@collabora.com>,
	"Willem de Bruijn" <willemb@google.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-kselftest <linux-kselftest@vger.kernel.org>,
	LSM <linux-security-module@vger.kernel.org>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH v1 1/5] hostfs: Fix ephemeral inodes
Date: Mon, 29 May 2023 16:57:11 +0200	[thread overview]
Message-ID: <a0c3e6d4-2827-d9b4-8f4e-aef25997fa8a@digikod.net> (raw)
In-Reply-To: <8249dd59-ce08-2253-1697-301ad082d905@digikod.net>


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@digikod.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@cambridgegreys.com>
>>> Cc: Johannes Berg <johannes@sipsolutions.net>
>>> Cc: Richard Weinberger <richard@nod.at>
>>> Cc: <stable@vger.kernel.org> # 5.15.x: ce72750f04d6: hostfs: Fix writeback of
>>> dirty pages
>>> Cc: <stable@vger.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@digikod.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.

  reply	other threads:[~2023-05-29 14:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 16:54 [PATCH v1 0/5] Landlock support for UML Mickaël Salaün
2023-03-09 16:54 ` [PATCH v1 1/5] hostfs: Fix ephemeral inodes Mickaël Salaün
2023-05-21 21:13   ` Richard Weinberger
2023-05-26 16:40     ` Mickaël Salaün
2023-05-29 14:57       ` Mickaël Salaün [this message]
2023-06-05 20:06         ` Richard Weinberger
2023-06-06 13:12   ` Roberto Sassu
2023-06-12 15:14     ` Mickaël Salaün
2023-03-09 16:54 ` [PATCH v1 2/5] selftests/landlock: Don't create useless file layouts Mickaël Salaün
2023-03-09 16:54 ` [PATCH v1 3/5] selftests/landlock: Add supports_filesystem() helper Mickaël Salaün
2023-03-09 16:54 ` [PATCH v1 4/5] selftests/landlock: Make mounts configurable Mickaël Salaün
2023-03-09 16:54 ` [PATCH v1 5/5] selftests/landlock: Add tests for pseudo filesystems Mickaël Salaün
2023-03-21 21:18 ` [PATCH v1 0/5] Landlock support for UML Mickaël Salaün
2023-03-21 21:38   ` Richard Weinberger
2023-04-04 13:52     ` Mickaël Salaün
2023-05-04 16:01       ` Mickaël Salaün

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=a0c3e6d4-2827-d9b4-8f4e-aef25997fa8a@digikod.net \
    --to=mic@digikod.net \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=chris.obbard@collabora.com \
    --cc=gnoack3000@gmail.com \
    --cc=groeck@chromium.org \
    --cc=jeffxu@google.com \
    --cc=jmorris@namei.org \
    --cc=johannes@sipsolutions.net \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=richard@nod.at \
    --cc=ritesh@collabora.com \
    --cc=serge@hallyn.com \
    --cc=sjoerd@collabora.com \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=willemb@google.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.