All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] fscrypt: avoid GFP_NOFS-unsafe key setup during transaction
@ 2020-08-24  6:17 ` Eric Biggers
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Biggers @ 2020-08-24  6:17 UTC (permalink / raw)
  To: linux-fscrypt
  Cc: linux-ext4, linux-f2fs-devel, linux-mtd, ceph-devel, Jeff Layton

This series fixes some deadlocks which are theoretically possible due to
fscrypt_get_encryption_info() being GFP_NOFS-unsafe, and thus not safe
to be called from within an ext4 transaction or under f2fs_lock_op().

The problem is solved by new helper functions which allow setting up the
key for new inodes earlier.  Patch 1 adds these helper functions.  Also
see that patch for a more detailed description of this problem.

Patches 2-6 then convert ext4, f2fs, and ubifs to use these new helpers.

Patch 7-8 then clean up a few things afterwards.

Coincidentally, this also solves some of the ordering problems that
ceph fscrypt support will have.  For more details about this, see the
discussion on Jeff Layton's RFC patchset for ceph fscrypt support
(https://lkml.kernel.org/linux-fscrypt/20200821182813.52570-1-jlayton@kernel.org/T/#u)
However, fscrypt_prepare_new_inode() still requires that the new
'struct inode' exist already, so it might not be enough for ceph yet.

This patchset applies to v5.9-rc2.

Eric Biggers (8):
  fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context()
  ext4: factor out ext4_xattr_credits_for_new_inode()
  ext4: remove some #ifdefs in ext4_xattr_credits_for_new_inode()
  ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context()
  f2fs: use fscrypt_prepare_new_inode() and fscrypt_set_context()
  ubifs: use fscrypt_prepare_new_inode() and fscrypt_set_context()
  fscrypt: remove fscrypt_inherit_context()
  fscrypt: stop pretending that key setup is nofs-safe

 fs/crypto/fscrypt_private.h |   3 +
 fs/crypto/hooks.c           |  10 +-
 fs/crypto/inline_crypt.c    |   7 +-
 fs/crypto/keysetup.c        | 190 ++++++++++++++++++++++++++++--------
 fs/crypto/keysetup_v1.c     |   8 +-
 fs/crypto/policy.c          |  64 +++++++-----
 fs/ext4/ialloc.c            | 118 +++++++++++-----------
 fs/f2fs/dir.c               |   2 +-
 fs/f2fs/f2fs.h              |  16 ---
 fs/f2fs/namei.c             |   7 +-
 fs/ubifs/dir.c              |  26 ++---
 include/linux/fscrypt.h     |  18 +++-
 12 files changed, 293 insertions(+), 176 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2020-08-24 20:49 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24  6:17 [RFC PATCH 0/8] fscrypt: avoid GFP_NOFS-unsafe key setup during transaction Eric Biggers
2020-08-24  6:17 ` Eric Biggers
2020-08-24  6:17 ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 1/8] fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24 16:48   ` Jeff Layton
2020-08-24 16:48     ` Jeff Layton
2020-08-24 16:48     ` [f2fs-dev] " Jeff Layton
2020-08-24 18:21     ` Eric Biggers
2020-08-24 18:21       ` Eric Biggers
2020-08-24 18:21       ` [f2fs-dev] " Eric Biggers
2020-08-24 18:47       ` Jeff Layton
2020-08-24 18:47         ` Jeff Layton
2020-08-24 18:47         ` [f2fs-dev] " Jeff Layton
2020-08-24 19:02         ` Eric Biggers
2020-08-24 19:02           ` Eric Biggers
2020-08-24 19:02           ` [f2fs-dev] " Eric Biggers
2020-08-24 19:42           ` Jeff Layton
2020-08-24 19:42             ` Jeff Layton
2020-08-24 19:42             ` [f2fs-dev] " Jeff Layton
2020-08-24 20:49             ` Eric Biggers
2020-08-24 20:49               ` Eric Biggers
2020-08-24 20:49               ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 2/8] ext4: factor out ext4_xattr_credits_for_new_inode() Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 3/8] ext4: remove some #ifdefs in ext4_xattr_credits_for_new_inode() Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 4/8] ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context() Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 5/8] f2fs: " Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 6/8] ubifs: " Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 7/8] fscrypt: remove fscrypt_inherit_context() Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers
2020-08-24  6:17 ` [RFC PATCH 8/8] fscrypt: stop pretending that key setup is nofs-safe Eric Biggers
2020-08-24  6:17   ` Eric Biggers
2020-08-24  6:17   ` [f2fs-dev] " Eric Biggers

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.