mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Baokun Li <libaokun@linux.alibaba.com>
Cc: linux-fscrypt@vger.kernel.org, jaegeuk@kernel.org, tytso@mit.edu,
	linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca,
	jack@suse.cz, yi.zhang@huawei.com, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] fscrypt: Cap data units at the page size
Date: Wed, 4 Nov 2026 11:51:27 -0800	[thread overview]
Message-ID: <20261104195127.GA1971@quark> (raw)
In-Reply-To: <922240f9-8233-4466-a787-2f7ddba7c490@linux.alibaba.com>

On Wed, Nov 04, 2026 at 10:31:46AM +0800, Baokun Li wrote:
> What I had in mind before was to keep the default as min(bs, PS) and
> allow DU > PS only when explicitly specified, which seemed to give
> better compatibility.  Cross-machine or cross-page-size cases seem
> uncommon, and existing machines have probably already avoided them by
> specifying a 4K or smaller DU.
> 
> Keeping the existing default semantics and returning an error in the
> LBS case for the user to specify seems feasible.  But then
> test_dummy_encryption and the xfstests cases that use the default would
> need to specify the DU explicitly, otherwise the LBS + encrypt test
> coverage would drop a lot.  That is, in the kernel or the tests we
> always have to set a default DU size.
> 
> If you confirm that we should take the route where LBS requires an
> explicit data unit size and the default is rejected, I can adapt the
> kernel and xfstests in v2.  Or should we go back to the more compatible
> DU > page size approach?

It will indeed be annoying to have to explicitly specify the data unit
size, but I don't see a better solution for now, given the complexity of
supporting data unit sizes larger than the page size.  I think making
the on-disk format needing PAGE_SIZE to interpret is a no-go.

I suppose that in theory, how FS_IOC_SET_ENCRYPTION_POLICY handles
log2_data_unit_size=0 could be changed: it could start actually writing
log2_data_unit_size=12 to disk (rather than writing 0 which means the
filesystem block size).  I think that can still lead to problems,
though.  For one FS_IOC_GET_ENCRYPTION_POLICY would return something
different from what was set.

Regarding xfstests, take a look at how common/verity adds $FSV_BLOCKSIZE
to all 'fsverity enable' commands by default, to select some Merkle tree
block size that the filesystem supports.  Something similar could be
done with fscrypt.  Yes, this won't work with v1 encryption policies,
but v1 policies are obsolete.  Most of the xfstests that use v1 policies
should just be updated to use v2 instead.  The btrfs folks were working
on that earlier, since they're not planning to support v1 at all.

- Eric

  reply	other threads:[~2026-11-04 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:31 [PATCH 0/4] ext4: support encryption with block size larger than " Baokun Li
2026-11-03 15:31 ` [PATCH 1/4] fscrypt: Cap data units at the " Baokun Li
2026-11-03 22:40   ` Eric Biggers
2026-11-04  2:31     ` Baokun Li
2026-11-04 19:51       ` Eric Biggers [this message]
2026-11-03 15:31 ` [PATCH 2/4] fscrypt: Validate the test_dummy_encryption policy for new inodes Baokun Li
2026-11-03 15:31 ` [PATCH 3/4] ext4: don't put a DUN wraparound in the middle of a read bio Baokun Li
2026-11-03 15:31 ` [PATCH 4/4] ext4: allow large folios and bs > ps encryption Baokun Li

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=20261104195127.GA1971@quark \
    --to=ebiggers@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®