mbox series

[v3,00/11] fscrypt: rearrangements preliminary to extent encryption

Message ID cover.1681837335.git.sweettea-kernel@dorminy.me (mailing list archive)
Headers show
Series fscrypt: rearrangements preliminary to extent encryption | expand

Message

Sweet Tea Dorminy April 18, 2023, 5:04 p.m. UTC
As per [1], extent-based encryption needs to split allocating and
preparing crypto_skciphers, since extent infos will be loaded at IO time
and crypto_skciphers cannot be allocated at IO time. 

This changeset undertakes to split the existing code to clearly
distinguish preparation and allocation of fscrypt_prepared_keys,
wrapping crypto_skciphers. Elegance of code is in the eye of the
beholder, but I've tried a decent variety of arrangements here and this
seems like the clearest result to me; happy to adjust as desired, and
more changesets coming soon, this just seemed like the clearest cutoff
point for preliminaries without being pure refactoring.

Patchset should apply cleanly to fscrypt/for-next (as per base-commit
below), and pass ext4/f2fs tests (kvm-xfstests is not currently
succesfully setting up ubifs volumes for me).

[1] https://lore.kernel.org/linux-btrfs/Y7NQ1CvPyJiGRe00@sol.localdomain/ 

Changes from v2:
Combined the two changes affecting ci->ci_direct_key.
Combined last two changes in v2 and rearranged to lock for every check
of mode keys.
Addressed hopefully all style comments.
Added another change, a tiny helper.

Changes from v1:
Included change 1, erroneously dropped, and generated patches using --base.

Sweet Tea Dorminy (11):
  fscrypt: move inline crypt decision to info setup.
  fscrypt: split and rename setup_file_encryption_key()
  fscrypt: split setup_per_mode_enc_key()
  fscrypt: move dirhash key setup away from IO key setup
  fscrypt: reduce special-casing of IV_INO_LBLK_32
  fscrypt: make infos have a pointer to prepared keys
  fscrypt: move all the shared mode key setup deeper
  fscrypt: make prepared keys record their type.
  fscrypt: lock every time a info needs a mode key
  fscrypt: split key alloc and preparation
  fscrypt: factor helper for locking master key

 fs/crypto/crypto.c          |   2 +-
 fs/crypto/fname.c           |   4 +-
 fs/crypto/fscrypt_private.h |  67 ++++--
 fs/crypto/inline_crypt.c    |  29 +--
 fs/crypto/keysetup.c        | 454 +++++++++++++++++++++++-------------
 fs/crypto/keysetup_v1.c     |  15 +-
 6 files changed, 362 insertions(+), 209 deletions(-)