All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	"Theodore Y . Ts'o " <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Eric Biggers <ebiggers@kernel.org>,
	linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org,
	kernel-team@fb.com
Cc: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Subject: [PATCH 00/21] btrfs: add fscrypt integration
Date: Wed, 17 Aug 2022 10:49:44 -0400	[thread overview]
Message-ID: <cover.1660744500.git.sweettea-kernel@dorminy.me> (raw)

This is a changeset adding encryption to btrfs.

Last October, Omar Sandoval sent out a design document for having fscrypt
integration with btrfs [1]. In summary, it proposes btrfs storing its
own encryption IVs on a per-file-extent basis. fscrypt usually encrypts
files using an IV derived from per-inode information; this would prevent
snapshotting or reflinking or data relocation for btrfs, but by using an
IV associated with each file extent, all the inodes sharing a particular
key and file extent may decrypt successfully.

This series implements this integration for the simple
case, non-compressed data extents. Followup changes will allow
encryption of compressed extents, inline extents, and verity items. 
This series should provide encryption for the simplest cases, but
this series should not be used except for testing yet, as there are
likely bugs particularly around IV retrieval.
 
Preliminary btrfs-progs changes are available at [2]; fstests changes
are available at [3]. Additional tests around subvolume-level encryption
will be added in the next version. 

[1]
https://lore.kernel.org/linux-btrfs/YXGyq+buM79A1S0L@relinquished.localdomain/
[2] https://lore.kernel.org/linux-btrfs/cover.1660729916.git.sweettea-kernel@dorminy.me
[3] https://lore.kernel.org/linux-btrfs/cover.1660729861.git.sweettea-kernel@dorminy.me

Changelog:

v1:
 - Recombined the fscrypt changes back into this patchset.
 - Fixed several races and incorrectly ordered operations.
 - Improved IV retrieval to correctly distinguish between
   filename/symlink encryption and encryption of block 0 of a file.
 - https://lore.kernel.org/linux-btrfs/cover.1660744500.git.sweettea-kernel@dorminy.me
RFC v2: 
 - Fixed all warnings and known incorrectnesses.
 - Split fscrypt changes into their own patchset:
    https://lore.kernel.org/linux-fscrypt/cover.1658623235.git.sweettea-kernel@dorminy.me
 - Combined and reordered changes so that enabling fscrypt is the last change.
 - Removed unnecessary factoring.
 - Split a cleanup change off.
 - https://lore.kernel.org/linux-btrfs/cover.1658623319.git.sweettea-kernel@dorminy.me 

RFC v1:
 - https://lore.kernel.org/linux-btrfs/cover.1657707686.git.sweettea-kernel@dorminy.me


Omar Sandoval (16):
  fscrypt: expose fscrypt_nokey_name
  fscrypt: add flag allowing partially-encrypted directories
  fscrypt: add fscrypt_have_same_policy() to check inode's compatibility
  btrfs: store directorys' encryption state
  btrfs: factor a fscrypt_name matching method
  btrfs: disable various operations on encrypted inodes
  btrfs: add fscrypt operation table to superblock
  btrfs: start using fscrypt hooks.
  btrfs: add fscrypt_context items.
  btrfs: translate btrfs encryption flags and encrypted inode flag.
  btrfs: store an IV per encrypted normal file extent
  btrfs: Add new FEATURE_INCOMPAT_FSCRYPT feature flag.
  btrfs: reuse encrypted filename hash when possible.
  btrfs: adapt directory read and lookup to potentially encrypted
    filenames
  btrfs: encrypt normal file extent data if appropriate
  btrfs: implement fscrypt ioctls

Sweet Tea Dorminy (5):
  fscrypt: add a function for a filesystem to generate an IV
  fscrypt: add new encryption policy for btrfs.
  btrfs: use fscrypt_name's instead of name/len everywhere.
  btrfs: setup fscrypt_names from dentrys using helper
  btrfs: add iv generation function for fscrypt

 fs/btrfs/Makefile               |   1 +
 fs/btrfs/btrfs_inode.h          |   3 +
 fs/btrfs/ctree.h                | 113 +++++--
 fs/btrfs/delayed-inode.c        |  48 ++-
 fs/btrfs/delayed-inode.h        |   9 +-
 fs/btrfs/dir-item.c             | 119 ++++---
 fs/btrfs/extent_io.c            |  93 +++++-
 fs/btrfs/extent_io.h            |   2 +
 fs/btrfs/extent_map.h           |   8 +
 fs/btrfs/file-item.c            |  20 +-
 fs/btrfs/file.c                 |  11 +-
 fs/btrfs/fscrypt.c              | 224 +++++++++++++
 fs/btrfs/fscrypt.h              |  49 +++
 fs/btrfs/inode-item.c           |  84 ++---
 fs/btrfs/inode-item.h           |  14 +-
 fs/btrfs/inode.c                | 573 ++++++++++++++++++++++++--------
 fs/btrfs/ioctl.c                |  80 ++++-
 fs/btrfs/ordered-data.c         |  13 +-
 fs/btrfs/ordered-data.h         |   3 +-
 fs/btrfs/print-tree.c           |   4 +-
 fs/btrfs/props.c                |  11 +-
 fs/btrfs/reflink.c              |   8 +
 fs/btrfs/root-tree.c            |  20 +-
 fs/btrfs/send.c                 | 141 +++++---
 fs/btrfs/super.c                |   8 +-
 fs/btrfs/transaction.c          |  43 ++-
 fs/btrfs/tree-checker.c         |  56 +++-
 fs/btrfs/tree-log.c             | 233 +++++++------
 fs/btrfs/tree-log.h             |   4 +-
 fs/btrfs/xattr.c                |  21 +-
 fs/crypto/crypto.c              |  40 ++-
 fs/crypto/fname.c               |  56 +---
 fs/crypto/fscrypt_private.h     |   4 +-
 fs/crypto/inline_crypt.c        |  20 +-
 fs/crypto/keysetup.c            |   5 +
 fs/crypto/policy.c              |  48 ++-
 include/linux/fscrypt.h         |  62 +++-
 include/uapi/linux/btrfs.h      |   1 +
 include/uapi/linux/btrfs_tree.h |  26 ++
 include/uapi/linux/fscrypt.h    |   1 +
 40 files changed, 1719 insertions(+), 560 deletions(-)
 create mode 100644 fs/btrfs/fscrypt.c
 create mode 100644 fs/btrfs/fscrypt.h

-- 
2.35.1


             reply	other threads:[~2022-08-17 14:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 14:49 Sweet Tea Dorminy [this message]
2022-08-17 14:49 ` [PATCH 01/21] fscrypt: expose fscrypt_nokey_name Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 02/21] fscrypt: add flag allowing partially-encrypted directories Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 03/21] fscrypt: add fscrypt_have_same_policy() to check inode's compatibility Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 04/21] fscrypt: add a function for a filesystem to generate an IV Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 05/21] fscrypt: add new encryption policy for btrfs Sweet Tea Dorminy
2022-08-17 15:54   ` Sweet Tea Dorminy
2022-08-18 22:07     ` Eric Biggers
2022-08-19  0:22       ` Sweet Tea Dorminy
2022-08-20  0:50         ` Eric Biggers
2022-08-17 14:49 ` [PATCH 06/21] btrfs: store directorys' encryption state Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 07/21] btrfs: use fscrypt_name's instead of name/len everywhere Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 08/21] btrfs: setup fscrypt_names from dentrys using helper Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 09/21] btrfs: factor a fscrypt_name matching method Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 10/21] btrfs: disable various operations on encrypted inodes Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 11/21] btrfs: add fscrypt operation table to superblock Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 12/21] btrfs: start using fscrypt hooks Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 13/21] btrfs: add fscrypt_context items Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 14/21] btrfs: translate btrfs encryption flags and encrypted inode flag Sweet Tea Dorminy
2022-08-17 14:49 ` [PATCH 15/21] btrfs: add iv generation function for fscrypt Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 16/21] btrfs: store an IV per encrypted normal file extent Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 17/21] btrfs: Add new FEATURE_INCOMPAT_FSCRYPT feature flag Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 18/21] btrfs: reuse encrypted filename hash when possible Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 19/21] btrfs: adapt directory read and lookup to potentially encrypted filenames Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 20/21] btrfs: encrypt normal file extent data if appropriate Sweet Tea Dorminy
2022-08-17 14:50 ` [PATCH 21/21] btrfs: implement fscrypt ioctls Sweet Tea Dorminy

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=cover.1660744500.git.sweettea-kernel@dorminy.me \
    --to=sweettea-kernel@dorminy.me \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=ebiggers@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.