From: Baokun Li <libaokun@linux.alibaba.com>
To: Eric Biggers <ebiggers@kernel.org>
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: Fri, 6 Nov 2026 00:37:30 +0800 [thread overview]
Message-ID: <ae6f5ba2-8afc-43db-8d0a-f82d0163702d@linux.alibaba.com> (raw)
In-Reply-To: <20261104195127.GA1971@quark>
On 2026/11/5 03:51, Eric Biggers wrote:
> 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.
>
Agreed.
> 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.
I also considered making the default explicit, e.g. 4096, when the
bs > PS. GET_ENCRYPTION_POLICY would then report 4096 instead of
the 0 that was set, which I think is fine provided we log it:
an unset field means "use the kernel default", and this just pins
down what that default is. This works for v2.
I dropped it over test_dummy_encryption: mount options are parsed
before the block size is known, and the policy is const once it is,
so only invasive changes would work.
But the dummy policy is recreated on every mount and never persisted,
so there is no on-disk policy to stay compatible with. The template
can just use SECTOR_SHIFT (simplest); alternatively, refuse it on such
a fs, or support an explicit du_size through a helper shared by the fs
(most complex).
>
> 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.
>
Agreed on rejecting v1. The xfstests cases that need it will have to
be skipped or converted to v2; I can do that if nobody else is on it.
So, to enable this by default when bs > PS:
1. reject v1, and convert the xfstests cases;
2. in fscrypt_ioctl_set_policy(), make the default 4096 explicit
and log it;
3. for dummy, either use SECTOR_SHIFT, refuse it on such a
fs and skip the tests, or support an explicit du_size?
Looking forward to hearing your thoughts.
Cheers,
Baokun
next prev parent reply other threads:[~2026-11-05 16:37 UTC|newest]
Thread overview: 9+ 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
2026-11-05 16:37 ` Baokun Li [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=ae6f5ba2-8afc-43db-8d0a-f82d0163702d@linux.alibaba.com \
--to=libaokun@linux.alibaba.com \
--cc=adilger.kernel@dilger.ca \
--cc=ebiggers@kernel.org \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--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®