]> git.proxmox.com Git - mirror_zfs.git/commit - include/sys/zfs_ioctl.h
Encryption Stability and On-Disk Format Fixes
authorTom Caputi <tcaputi@datto.com>
Wed, 8 Nov 2017 19:12:59 +0000 (14:12 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 2 Feb 2018 19:37:16 +0000 (11:37 -0800)
commitae76f45cda0e0857f99e53959cf71c7a5d66bd8b
treee1c3cabe0971272785a442d6fb627bf6ebd07148
parent4c46b99d24a6e71b3c72462c11cb051d0930ad60
Encryption Stability and On-Disk Format Fixes

The on-disk format for encrypted datasets protects not only
the encrypted and authenticated blocks themselves, but also
the order and interpretation of these blocks. In order to
make this work while maintaining the ability to do raw
sends, the indirect bps maintain a secure checksum of all
the MACs in the block below it along with a few other
fields that determine how the data is interpreted.

Unfortunately, the current on-disk format erroneously
includes some fields which are not portable and thus cannot
support raw sends. It is not possible to easily work around
this issue due to a separate and much smaller bug which
causes indirect blocks for encrypted dnodes to not be
compressed, which conflicts with the previous bug. In
addition, the current code generates incompatible on-disk
formats on big endian and little endian systems due to an
issue with how block pointers are authenticated. Finally,
raw send streams do not currently include dn_maxblkid when
sending both the metadnode and normal dnodes which are
needed in order to ensure that we are correctly maintaining
the portable objset MAC.

This patch zero's out the offending fields when computing
the bp MAC and ensures that these MACs are always
calculated in little endian order (regardless of the host
system's byte order). This patch also registers an errata
for the old on-disk format, which we detect by adding a
"version" field to newly created DSL Crypto Keys. We allow
datasets without a version (version 0) to only be mounted
for read so that they can easily be migrated. We also now
include dn_maxblkid in raw send streams to ensure the MAC
can be maintained correctly.

This patch also contains minor bug fixes and cleanups.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #6845
Closes #6864
Closes #7052
31 files changed:
cmd/zfs/zfs_main.c
cmd/zpool/zpool_main.c
cmd/zstreamdump/zstreamdump.c
contrib/dracut/90zfs/zfs-load-key.sh [new file with mode: 0644]
include/sys/dmu.h
include/sys/dmu_objset.h
include/sys/dnode.h
include/sys/dsl_crypt.h
include/sys/fs/zfs.h
include/sys/zfs_ioctl.h
include/sys/zio_crypt.h
lib/libzfs/libzfs_crypto.c
lib/libzfs/libzfs_status.c
module/zfs/arc.c
module/zfs/dmu.c
module/zfs/dmu_objset.c
module/zfs/dmu_send.c
module/zfs/dnode.c
module/zfs/dnode_sync.c
module/zfs/dsl_crypt.c
module/zfs/dsl_dir.c
module/zfs/zfs_vfsops.c
module/zfs/zio.c
module/zfs/zio_crypt.c
module/zfs/zvol.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_import/cryptv0.dat.bz2 [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/rsend/Makefile.am
tests/zfs-tests/tests/functional/rsend/send_encrypted_files.ksh [new file with mode: 0644]