From: Eric Biggers <ebiggers@kernel.org>
To: Daniel Rosenberg <drosen@google.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: Restrict max filesize for 16K f2fs
Date: Mon, 4 Dec 2023 17:28:31 -0800 [thread overview]
Message-ID: <20231205012831.GA1168@sol.localdomain> (raw)
In-Reply-To: <20231204234615.3592624-1-drosen@google.com>
On Mon, Dec 04, 2023 at 03:46:15PM -0800, Daniel Rosenberg via Linux-f2fs-devel wrote:
> Blocks are tracked by u32, so the max permitted filesize is
> U32_MAX * BLOCK_SIZE. Additionally, in order to support crypto data unit
> sizes of 4K with a 16K block size with IV_INO_LBLK_{32,63}, we must
{32,63} should be {32,64}
> + /*
> + * For compatibility with FSCRYPT_POLICY_IV_INO_LBLK_{64,32} with a
> + * 4K crypto data unit, we must restrict the max filesize to what can
> + * fit within U32_MAX data units.
FSCRYPT_POLICY_IV_INO_LBLK_{64,32} should be
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_{64,32}
> + *
> + * Since the blocksize must currently be equal to the page size,
> + * we can use a constant for that. Note if this is not the case
> + * in the future that inode is NULL while setting up the superblock.
I'm not sure what the last sentence is trying to say.
> + */
> +
> + result = min(result, ((loff_t) U32_MAX * 4096) >> F2FS_BLKSIZE_BITS);
Is it intentional that this is off by 1? If indices can be up to U32_MAX, then
the maximum size is U32_MAX + 1. It's not a bad idea to go with the lower size,
so that max_index + 1 does not overflow. But that's not what the explanation
says, so this seems to be accidental.
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2023-12-05 1:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 23:46 [f2fs-dev] [PATCH v2] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg via Linux-f2fs-devel
2023-12-05 1:28 ` Eric Biggers [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=20231205012831.GA1168@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=drosen@google.com \
--cc=jaegeuk@kernel.org \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).