mbox series

[0/1] userspace support for F2FS metadata encryption

Message ID 20201005074133.1958633-1-satyat@google.com (mailing list archive)
Headers show
Series userspace support for F2FS metadata encryption | expand

Message

Satya Tangirala Oct. 5, 2020, 7:41 a.m. UTC
The kernel patches for F2FS metadata encryption are at:

https://lore.kernel.org/linux-fscrypt/20201005073606.1949772-4-satyat@google.com/

This patch implements the userspace changes required for metadata
encryption support as implemented in the kernel changes above. All blocks
in the filesystem are encrypted with the user provided metadata encryption
key except for the superblock (and its redundant copy). The DUN for a block
is its offset from the start of the filesystem.

This patch introduces two new options for the userspace tools: '-A' to
specify the encryption algorithm, and '-M' to specify the encryption key.
mkfs.f2fs will store the encryption algorithm used for metadata encryption
in the superblock itself, so '-A' is only applicable to mkfs.f2fs. The rest
of the tools only take the '-M' option, and will obtain the encryption
algorithm from the superblock of the FS.

Limitations: 
Metadata encryption with sparse storage has not been implemented yet in
this patch.

This patch requires the metadata encryption key to be readable from
userspace, and does not ensure that it is zeroed before the program exits
for any reason.

Satya Tangirala (1):
  f2fs-tools: Introduce metadata encryption support

 fsck/main.c                   |  47 ++++++-
 fsck/mount.c                  |  33 ++++-
 include/f2fs_fs.h             |  10 +-
 include/f2fs_metadata_crypt.h |  21 ++++
 lib/Makefile.am               |   4 +-
 lib/f2fs_metadata_crypt.c     | 226 ++++++++++++++++++++++++++++++++++
 lib/libf2fs_io.c              |  87 +++++++++++--
 mkfs/f2fs_format.c            |   5 +-
 mkfs/f2fs_format_main.c       |  33 ++++-
 9 files changed, 446 insertions(+), 20 deletions(-)
 create mode 100644 include/f2fs_metadata_crypt.h
 create mode 100644 lib/f2fs_metadata_crypt.c

Comments

Eric Biggers Oct. 7, 2020, 9:39 p.m. UTC | #1
On Mon, Oct 05, 2020 at 07:41:32AM +0000, Satya Tangirala wrote:
> The kernel patches for F2FS metadata encryption are at:
> 
> https://lore.kernel.org/linux-fscrypt/20201005073606.1949772-4-satyat@google.com/
> 
> This patch implements the userspace changes required for metadata
> encryption support as implemented in the kernel changes above. All blocks
> in the filesystem are encrypted with the user provided metadata encryption
> key except for the superblock (and its redundant copy). The DUN for a block
> is its offset from the start of the filesystem.
> 
> This patch introduces two new options for the userspace tools: '-A' to
> specify the encryption algorithm, and '-M' to specify the encryption key.
> mkfs.f2fs will store the encryption algorithm used for metadata encryption
> in the superblock itself, so '-A' is only applicable to mkfs.f2fs. The rest
> of the tools only take the '-M' option, and will obtain the encryption
> algorithm from the superblock of the FS.

As I mentioned on the kernel patches, it might make sense to compute a
metadata_key_identifier and store it in the super_block so that it can be
automatically requested without needing to provide an option.

> 
> Limitations: 
> Metadata encryption with sparse storage has not been implemented yet in
> this patch.
> 
> This patch requires the metadata encryption key to be readable from
> userspace, and does not ensure that it is zeroed before the program exits
> for any reason.
> 
> Satya Tangirala (1):
>   f2fs-tools: Introduce metadata encryption support

A cover letter shouldn't be used for a 1-patch series.  Just include these
details in the patch instead.

- Eric
Jaegeuk Kim Dec. 17, 2020, 4:23 p.m. UTC | #2
Hi Satya,

Could you please consider to rebase the patches on f2fs-tools/dev branch?
I've applied compression support which will have some conflicts with this
series. And, could you check this works with multi-partition support?

Thanks,

On 10/05, Satya Tangirala wrote:
> The kernel patches for F2FS metadata encryption are at:
> 
> https://lore.kernel.org/linux-fscrypt/20201005073606.1949772-4-satyat@google.com/
> 
> This patch implements the userspace changes required for metadata
> encryption support as implemented in the kernel changes above. All blocks
> in the filesystem are encrypted with the user provided metadata encryption
> key except for the superblock (and its redundant copy). The DUN for a block
> is its offset from the start of the filesystem.
> 
> This patch introduces two new options for the userspace tools: '-A' to
> specify the encryption algorithm, and '-M' to specify the encryption key.
> mkfs.f2fs will store the encryption algorithm used for metadata encryption
> in the superblock itself, so '-A' is only applicable to mkfs.f2fs. The rest
> of the tools only take the '-M' option, and will obtain the encryption
> algorithm from the superblock of the FS.
> 
> Limitations: 
> Metadata encryption with sparse storage has not been implemented yet in
> this patch.
> 
> This patch requires the metadata encryption key to be readable from
> userspace, and does not ensure that it is zeroed before the program exits
> for any reason.
> 
> Satya Tangirala (1):
>   f2fs-tools: Introduce metadata encryption support
> 
>  fsck/main.c                   |  47 ++++++-
>  fsck/mount.c                  |  33 ++++-
>  include/f2fs_fs.h             |  10 +-
>  include/f2fs_metadata_crypt.h |  21 ++++
>  lib/Makefile.am               |   4 +-
>  lib/f2fs_metadata_crypt.c     | 226 ++++++++++++++++++++++++++++++++++
>  lib/libf2fs_io.c              |  87 +++++++++++--
>  mkfs/f2fs_format.c            |   5 +-
>  mkfs/f2fs_format_main.c       |  33 ++++-
>  9 files changed, 446 insertions(+), 20 deletions(-)
>  create mode 100644 include/f2fs_metadata_crypt.h
>  create mode 100644 lib/f2fs_metadata_crypt.c
> 
> -- 
> 2.28.0.806.g8561365e88-goog
Satya Tangirala Dec. 18, 2020, 6:41 a.m. UTC | #3
On Thu, Dec 17, 2020 at 08:23:18AM -0800, Jaegeuk Kim wrote:
> Hi Satya,
> 
> Could you please consider to rebase the patches on f2fs-tools/dev branch?
> I've applied compression support which will have some conflicts with this
> series. And, could you check this works with multi-partition support?
> 
Sure, I'll do that! I sent out v2 of this patch series earlier today,
so would you want me to send out a rebased version asap? or when
I send out v3?

Also, newbie question - multi-partition support is the same as
multi-device support, right?
> Thanks,
> 
> On 10/05, Satya Tangirala wrote:
> > The kernel patches for F2FS metadata encryption are at:
> > 
> > https://lore.kernel.org/linux-fscrypt/20201005073606.1949772-4-satyat@google.com/
> > 
> > This patch implements the userspace changes required for metadata
> > encryption support as implemented in the kernel changes above. All blocks
> > in the filesystem are encrypted with the user provided metadata encryption
> > key except for the superblock (and its redundant copy). The DUN for a block
> > is its offset from the start of the filesystem.
> > 
> > This patch introduces two new options for the userspace tools: '-A' to
> > specify the encryption algorithm, and '-M' to specify the encryption key.
> > mkfs.f2fs will store the encryption algorithm used for metadata encryption
> > in the superblock itself, so '-A' is only applicable to mkfs.f2fs. The rest
> > of the tools only take the '-M' option, and will obtain the encryption
> > algorithm from the superblock of the FS.
> > 
> > Limitations: 
> > Metadata encryption with sparse storage has not been implemented yet in
> > this patch.
> > 
> > This patch requires the metadata encryption key to be readable from
> > userspace, and does not ensure that it is zeroed before the program exits
> > for any reason.
> > 
> > Satya Tangirala (1):
> >   f2fs-tools: Introduce metadata encryption support
> > 
> >  fsck/main.c                   |  47 ++++++-
> >  fsck/mount.c                  |  33 ++++-
> >  include/f2fs_fs.h             |  10 +-
> >  include/f2fs_metadata_crypt.h |  21 ++++
> >  lib/Makefile.am               |   4 +-
> >  lib/f2fs_metadata_crypt.c     | 226 ++++++++++++++++++++++++++++++++++
> >  lib/libf2fs_io.c              |  87 +++++++++++--
> >  mkfs/f2fs_format.c            |   5 +-
> >  mkfs/f2fs_format_main.c       |  33 ++++-
> >  9 files changed, 446 insertions(+), 20 deletions(-)
> >  create mode 100644 include/f2fs_metadata_crypt.h
> >  create mode 100644 lib/f2fs_metadata_crypt.c
> > 
> > -- 
> > 2.28.0.806.g8561365e88-goog
Jaegeuk Kim Dec. 18, 2020, 4:19 p.m. UTC | #4
On 12/18, Satya Tangirala wrote:
> On Thu, Dec 17, 2020 at 08:23:18AM -0800, Jaegeuk Kim wrote:
> > Hi Satya,
> > 
> > Could you please consider to rebase the patches on f2fs-tools/dev branch?
> > I've applied compression support which will have some conflicts with this
> > series. And, could you check this works with multi-partition support?
> > 
> Sure, I'll do that! I sent out v2 of this patch series earlier today,
> so would you want me to send out a rebased version asap? or when
> I send out v3?

Thank you. Please let me have the latest update like v3.

> 
> Also, newbie question - multi-partition support is the same as
> multi-device support, right?

Yes, right. :)

> > Thanks,
> > 
> > On 10/05, Satya Tangirala wrote:
> > > The kernel patches for F2FS metadata encryption are at:
> > > 
> > > https://lore.kernel.org/linux-fscrypt/20201005073606.1949772-4-satyat@google.com/
> > > 
> > > This patch implements the userspace changes required for metadata
> > > encryption support as implemented in the kernel changes above. All blocks
> > > in the filesystem are encrypted with the user provided metadata encryption
> > > key except for the superblock (and its redundant copy). The DUN for a block
> > > is its offset from the start of the filesystem.
> > > 
> > > This patch introduces two new options for the userspace tools: '-A' to
> > > specify the encryption algorithm, and '-M' to specify the encryption key.
> > > mkfs.f2fs will store the encryption algorithm used for metadata encryption
> > > in the superblock itself, so '-A' is only applicable to mkfs.f2fs. The rest
> > > of the tools only take the '-M' option, and will obtain the encryption
> > > algorithm from the superblock of the FS.
> > > 
> > > Limitations: 
> > > Metadata encryption with sparse storage has not been implemented yet in
> > > this patch.
> > > 
> > > This patch requires the metadata encryption key to be readable from
> > > userspace, and does not ensure that it is zeroed before the program exits
> > > for any reason.
> > > 
> > > Satya Tangirala (1):
> > >   f2fs-tools: Introduce metadata encryption support
> > > 
> > >  fsck/main.c                   |  47 ++++++-
> > >  fsck/mount.c                  |  33 ++++-
> > >  include/f2fs_fs.h             |  10 +-
> > >  include/f2fs_metadata_crypt.h |  21 ++++
> > >  lib/Makefile.am               |   4 +-
> > >  lib/f2fs_metadata_crypt.c     | 226 ++++++++++++++++++++++++++++++++++
> > >  lib/libf2fs_io.c              |  87 +++++++++++--
> > >  mkfs/f2fs_format.c            |   5 +-
> > >  mkfs/f2fs_format_main.c       |  33 ++++-
> > >  9 files changed, 446 insertions(+), 20 deletions(-)
> > >  create mode 100644 include/f2fs_metadata_crypt.h
> > >  create mode 100644 lib/f2fs_metadata_crypt.c
> > > 
> > > -- 
> > > 2.28.0.806.g8561365e88-goog