All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niels de Vos <ndevos@redhat.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Xiubo Li <xiubli@redhat.com>,
	Marcel Lauhoff <marcel.lauhoff@suse.com>
Subject: Re: [RFC 0/4] fs: provide per-filesystem options to disable fscrypt
Date: Fri, 18 Nov 2022 14:25:41 +0100	[thread overview]
Message-ID: <Y3eH1XOGlXUKCiMZ@ndevos-x1> (raw)
In-Reply-To: <Y3RGs5dONBt+GAxN@sol.localdomain>

On Tue, Nov 15, 2022 at 06:10:59PM -0800, Eric Biggers wrote:
> On Thu, Nov 10, 2022 at 03:12:21PM +0100, Niels de Vos wrote:
> > While more filesystems are getting support for fscrypt, it is useful to
> > be able to disable fscrypt for a selection of filesystems, while
> > enabling it for others.
> > 
> > The new USE_FS_ENCRYPTION define gets picked up in
> > include/linux/fscrypt.h. This allows filesystems to choose to use the
> > empty function definitions, or the functional ones when fscrypt is to be
> > used with the filesystem.
> > 
> > Using USE_FS_ENCRYPTION is a relatively clean approach, and requires
> > minimal changes to the filesystems supporting fscrypt. This RFC is
> > mostly for checking the acceptance of this solution, or if an other
> > direction is preferred.
> > 
> > ---
> > 
> > Niels de Vos (4):
> >   fscrypt: introduce USE_FS_ENCRYPTION
> >   fs: make fscrypt support an ext4 config option
> >   fs: make fscrypt support a f2fs config option
> >   fs: make fscrypt support a UBIFS config option
> 
> So as others have pointed out, it doesn't seem worth the complexity to do this.
> 
> For a bit of historical context, before Linux v5.1, we did have per-filesystem
> options for this: CONFIG_EXT4_ENCRYPTION, CONFIG_F2FS_FS_ENCRYPTION, and
> CONFIG_UBIFS_FS_ENCRYPTION.  If you enabled one of these, it selected
> CONFIG_FS_ENCRYPTION to get the code in fs/crypto/.  CONFIG_FS_ENCRYPTION was a
> tristate, so the code in fs/crypto/ could be built as a loadable module if it
> was only needed by filesystems that were loadable modules themselves.
> 
> Having fs/crypto/ possibly be a loadable module was problematic, though, because
> it made it impossible to call into fs/crypto/ from built-in code such as
> fs/buffer.c, fs/ioctl.c, fs/libfs.c, fs/super.c, fs/iomap/direct-io.c, etc.  So
> that's why we made CONFIG_FS_ENCRYPTION into a bool.  At the same time, we
> decided to simplify the kconfig options by removing the per-filesystem options
> so that it worked like CONFIG_QUOTA, CONFIG_FS_DAX, CONFIG_FS_POSIX_ACL, etc.
> 
> I suppose we *could* have *just* changed CONFIG_FS_ENCRYPTION to a bool to solve
> the first problem, and kept the per-filesystem options.  I think that wouldn't
> have made a lot of sense, though, for the reasons that Ted has already covered.

Yes, it seems that there is a move to reduce the Kconfig options and
(re)adding per-filesystem encryption support would be counterproductive.

> A further point, beyond what Ted has already covered, is that
> non-filesystem-specific code can't honor filesystem-specific options.  So e.g.
> if you had a filesystem with encryption disabled by kconfig, that then called
> into fs/iomap/direct-io.c to process an I/O request, it could potentially still
> call into fs/crypto/ to enable encryption on that I/O request, since
> fs/iomap/direct-io.c would think that encryption support is enabled.
> 
> Granted, that *should* never actually happen, because this would only make a
> difference on encrypted files, and the filesystem shouldn't have allowed an
> encrypted file to be opened if it doesn't have encryption support enabled.  But
> it does seem a bit odd, given that it would go against the goal of compiling out
> all encryption code for a filesystem.

Ah, yes, indeed! The boundaries between the options would be less clear,
and potential changes to shared functions under fs/ could have incorrect
assumptions about CONFIG_FS_ENCRYPTION. Even if this is not the case
now, optimizations/enhancements in the future might be more complicated
because of this.

Thanks for the additional details! Have a good weekend,
Niels


      reply	other threads:[~2022-11-18 13:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:12 [RFC 0/4] fs: provide per-filesystem options to disable fscrypt Niels de Vos
2022-11-10 14:12 ` [RFC 1/4] fscrypt: introduce USE_FS_ENCRYPTION Niels de Vos
2022-11-10 14:12 ` [RFC 2/4] fs: make fscrypt support an ext4 config option Niels de Vos
2022-11-10 14:12 ` [RFC 3/4] fs: make fscrypt support a f2fs " Niels de Vos
2022-11-10 14:12 ` [RFC 4/4] fs: make fscrypt support a UBIFS " Niels de Vos
2022-11-10 15:38 ` [RFC 0/4] fs: provide per-filesystem options to disable fscrypt Theodore Ts'o
2022-11-10 16:47   ` Niels de Vos
2022-11-10 18:15     ` Theodore Ts'o
2022-11-10 18:43       ` Theodore Ts'o
2022-11-18 13:05       ` Niels de Vos
2022-11-14  6:02     ` Christoph Hellwig
2022-11-18 13:13       ` Niels de Vos
2022-11-16  2:10 ` Eric Biggers
2022-11-18 13:25   ` Niels de Vos [this message]

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=Y3eH1XOGlXUKCiMZ@ndevos-x1 \
    --to=ndevos@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel.lauhoff@suse.com \
    --cc=xiubli@redhat.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.