All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	Andrey Albershteyn <aalbersh@redhat.com>
Subject: [PATCH v2 00/11] fsverity: support for non-4K pages
Date: Fri, 23 Dec 2022 12:36:27 -0800	[thread overview]
Message-ID: <20221223203638.41293-1-ebiggers@kernel.org> (raw)

[This patchset applies to mainline + some fsverity cleanups I sent out
 recently.  You can get everything from tag "fsverity-non4k-v2" of
 https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git ]

Currently, filesystems (ext4, f2fs, and btrfs) only support fsverity
when the Merkle tree block size, filesystem block size, and page size
are all the same.  In practice that means 4K, since increasing the page
size, e.g. to 16K, forces the Merkle tree block size and filesystem
block size to be increased accordingly.  That can be impractical; for
one, users want the same file signatures to work on all systems.

Therefore, this patchset reduces the coupling between these sizes.

First, patches 1-4 are cleanups.

Second, patches 5-9 allow the Merkle tree block size to be less than the
page size or filesystem block size, provided that it's not larger than
either one.  This involves, among other things, changing the way that
fs/verity/verify.c tracks which hash blocks have been verified.

Finally, patches 10-11 make ext4 support fsverity when the filesystem
block size is less than the page size.  Note, f2fs doesn't need similar
changes because f2fs always assumes that the filesystem block size and
page size are the same anyway.  I haven't looked into btrfs yet.

I've tested this patchset using the "verity" group of tests in xfstests
with the following xfstests patchset applied:
"[PATCH v2 00/10] xfstests: update verity tests for non-4K block and page size"
(https://lore.kernel.org/fstests/20221223010554.281679-1-ebiggers@kernel.org/T/#u)

Note: on the thread "[RFC PATCH 00/11] fs-verity support for XFS"
(https://lore.kernel.org/linux-xfs/20221213172935.680971-1-aalbersh@redhat.com/T/#u)
there have been many requests for other things to support, including:

  * folios in the pagecache
  * alternative Merkle tree caching methods
  * direct I/O
  * merkle_tree_block_size > page_size
  * extremely large files, using a reclaimable bitmap

We shouldn't try to boil the ocean, though, so to keep the scope of this
patchset manageable I haven't changed it significantly from v1.  This
patchset does bring us closer to many of the above, just not all the way
there.  I'd like to follow up this patchset with a change to support
folios, which should be straightforward.  Next, we can do a change to
generalize the Merkle tree interface to allow XFS to use an alternative
caching method, as that sounds like the highest priority item for XFS.

Anyway, the changelog is:

Changed in v2:
   - Rebased onto the recent fsverity cleanups.
   - Split some parts of the big "support verification" patch into
     separate patches.
   - Passed the data_pos to verify_data_block() instead of computing it
     using page->index, to make it ready for folio and DIO support.
   - Eliminated some unnecessary arithmetic in verify_data_block().
   - Changed the log_* fields in merkle_tree_params to u8.
   - Restored PageLocked and !PageUptodate checks for pagecache pages.
   - Eliminated the change to fsverity_hash_buffer().
   - Other small cleanups

Eric Biggers (11):
  fsverity: use unsigned long for level_start
  fsverity: simplify Merkle tree readahead size calculation
  fsverity: store log2(digest_size) precomputed
  fsverity: use EFBIG for file too large to enable verity
  fsverity: replace fsverity_hash_page() with fsverity_hash_block()
  fsverity: support verification with tree block size < PAGE_SIZE
  fsverity: support enabling with tree block size < PAGE_SIZE
  ext4: simplify ext4_readpage_limit()
  f2fs: simplify f2fs_readpage_limit()
  fs/buffer.c: support fsverity in block_read_full_folio()
  ext4: allow verity with fs block size < PAGE_SIZE

 Documentation/filesystems/fsverity.rst |  76 +++---
 fs/buffer.c                            |  67 ++++-
 fs/ext4/readpage.c                     |   3 +-
 fs/ext4/super.c                        |   5 -
 fs/f2fs/data.c                         |   3 +-
 fs/verity/enable.c                     | 260 ++++++++++----------
 fs/verity/fsverity_private.h           |  20 +-
 fs/verity/hash_algs.c                  |  24 +-
 fs/verity/open.c                       |  98 ++++++--
 fs/verity/verify.c                     | 325 +++++++++++++++++--------
 include/linux/fsverity.h               |  14 +-
 11 files changed, 565 insertions(+), 330 deletions(-)

-- 
2.39.0


WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: Andrey Albershteyn <aalbersh@redhat.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH v2 00/11] fsverity: support for non-4K pages
Date: Fri, 23 Dec 2022 12:36:27 -0800	[thread overview]
Message-ID: <20221223203638.41293-1-ebiggers@kernel.org> (raw)

[This patchset applies to mainline + some fsverity cleanups I sent out
 recently.  You can get everything from tag "fsverity-non4k-v2" of
 https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git ]

Currently, filesystems (ext4, f2fs, and btrfs) only support fsverity
when the Merkle tree block size, filesystem block size, and page size
are all the same.  In practice that means 4K, since increasing the page
size, e.g. to 16K, forces the Merkle tree block size and filesystem
block size to be increased accordingly.  That can be impractical; for
one, users want the same file signatures to work on all systems.

Therefore, this patchset reduces the coupling between these sizes.

First, patches 1-4 are cleanups.

Second, patches 5-9 allow the Merkle tree block size to be less than the
page size or filesystem block size, provided that it's not larger than
either one.  This involves, among other things, changing the way that
fs/verity/verify.c tracks which hash blocks have been verified.

Finally, patches 10-11 make ext4 support fsverity when the filesystem
block size is less than the page size.  Note, f2fs doesn't need similar
changes because f2fs always assumes that the filesystem block size and
page size are the same anyway.  I haven't looked into btrfs yet.

I've tested this patchset using the "verity" group of tests in xfstests
with the following xfstests patchset applied:
"[PATCH v2 00/10] xfstests: update verity tests for non-4K block and page size"
(https://lore.kernel.org/fstests/20221223010554.281679-1-ebiggers@kernel.org/T/#u)

Note: on the thread "[RFC PATCH 00/11] fs-verity support for XFS"
(https://lore.kernel.org/linux-xfs/20221213172935.680971-1-aalbersh@redhat.com/T/#u)
there have been many requests for other things to support, including:

  * folios in the pagecache
  * alternative Merkle tree caching methods
  * direct I/O
  * merkle_tree_block_size > page_size
  * extremely large files, using a reclaimable bitmap

We shouldn't try to boil the ocean, though, so to keep the scope of this
patchset manageable I haven't changed it significantly from v1.  This
patchset does bring us closer to many of the above, just not all the way
there.  I'd like to follow up this patchset with a change to support
folios, which should be straightforward.  Next, we can do a change to
generalize the Merkle tree interface to allow XFS to use an alternative
caching method, as that sounds like the highest priority item for XFS.

Anyway, the changelog is:

Changed in v2:
   - Rebased onto the recent fsverity cleanups.
   - Split some parts of the big "support verification" patch into
     separate patches.
   - Passed the data_pos to verify_data_block() instead of computing it
     using page->index, to make it ready for folio and DIO support.
   - Eliminated some unnecessary arithmetic in verify_data_block().
   - Changed the log_* fields in merkle_tree_params to u8.
   - Restored PageLocked and !PageUptodate checks for pagecache pages.
   - Eliminated the change to fsverity_hash_buffer().
   - Other small cleanups

Eric Biggers (11):
  fsverity: use unsigned long for level_start
  fsverity: simplify Merkle tree readahead size calculation
  fsverity: store log2(digest_size) precomputed
  fsverity: use EFBIG for file too large to enable verity
  fsverity: replace fsverity_hash_page() with fsverity_hash_block()
  fsverity: support verification with tree block size < PAGE_SIZE
  fsverity: support enabling with tree block size < PAGE_SIZE
  ext4: simplify ext4_readpage_limit()
  f2fs: simplify f2fs_readpage_limit()
  fs/buffer.c: support fsverity in block_read_full_folio()
  ext4: allow verity with fs block size < PAGE_SIZE

 Documentation/filesystems/fsverity.rst |  76 +++---
 fs/buffer.c                            |  67 ++++-
 fs/ext4/readpage.c                     |   3 +-
 fs/ext4/super.c                        |   5 -
 fs/f2fs/data.c                         |   3 +-
 fs/verity/enable.c                     | 260 ++++++++++----------
 fs/verity/fsverity_private.h           |  20 +-
 fs/verity/hash_algs.c                  |  24 +-
 fs/verity/open.c                       |  98 ++++++--
 fs/verity/verify.c                     | 325 +++++++++++++++++--------
 include/linux/fsverity.h               |  14 +-
 11 files changed, 565 insertions(+), 330 deletions(-)

-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

             reply	other threads:[~2022-12-23 20:37 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 20:36 Eric Biggers [this message]
2022-12-23 20:36 ` [f2fs-dev] [PATCH v2 00/11] fsverity: support for non-4K pages Eric Biggers
2022-12-23 20:36 ` [PATCH v2 01/11] fsverity: use unsigned long for level_start Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 02/11] fsverity: simplify Merkle tree readahead size calculation Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 03/11] fsverity: store log2(digest_size) precomputed Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 04/11] fsverity: use EFBIG for file too large to enable verity Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 05/11] fsverity: replace fsverity_hash_page() with fsverity_hash_block() Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 06/11] fsverity: support verification with tree block size < PAGE_SIZE Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 07/11] fsverity: support enabling " Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 08/11] ext4: simplify ext4_readpage_limit() Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 09/11] f2fs: simplify f2fs_readpage_limit() Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2022-12-23 20:36 ` [PATCH v2 10/11] fs/buffer.c: support fsverity in block_read_full_folio() Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2023-01-10  2:37   ` Andrew Morton
2023-01-10  2:37     ` [f2fs-dev] " Andrew Morton
2023-01-10  3:05     ` Eric Biggers
2023-01-10  3:05       ` [f2fs-dev] " Eric Biggers
2023-01-20 19:56       ` Eric Biggers
2023-01-20 19:56         ` [f2fs-dev] " Eric Biggers
2023-01-21  6:39         ` Christoph Hellwig
2023-01-21  6:39           ` [f2fs-dev] " Christoph Hellwig
2022-12-23 20:36 ` [PATCH v2 11/11] ext4: allow verity with fs block size < PAGE_SIZE Eric Biggers
2022-12-23 20:36   ` [f2fs-dev] " Eric Biggers
2023-01-04  6:38 ` [PATCH v2 00/11] fsverity: support for non-4K pages Ojaswin Mujoo
2023-01-04  6:38   ` [f2fs-dev] " Ojaswin Mujoo via Linux-f2fs-devel
2023-01-04  7:25   ` Eric Biggers
2023-01-04  7:25     ` [f2fs-dev] " Eric Biggers
2023-01-05 11:24     ` Ojaswin Mujoo
2023-01-05 11:24       ` [f2fs-dev] " Ojaswin Mujoo via Linux-f2fs-devel
2023-01-09 17:38 ` Eric Biggers
2023-01-09 17:38   ` [f2fs-dev] " Eric Biggers
2023-01-09 19:34   ` Andrey Albershteyn
2023-01-09 19:34     ` [f2fs-dev] " Andrey Albershteyn
2023-01-10  3:10     ` Eric Biggers
2023-01-10  3:10       ` [f2fs-dev] " Eric Biggers
2023-02-03 22:01 ` Eric Biggers
2023-02-03 22:01   ` [f2fs-dev] " Eric Biggers
2023-02-28  1:01 ` patchwork-bot+f2fs
2023-02-28  1:01   ` patchwork-bot+f2fs
2023-02-28  1:30   ` Eric Biggers
2023-02-28  1:30     ` [f2fs-dev] " Eric Biggers
2023-02-28  3:53     ` Jaegeuk Kim
2023-02-28  3:53       ` [f2fs-dev] " Jaegeuk Kim

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=20221223203638.41293-1-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@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 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.