]> granicus.if.org Git - zfs/commit
Detect and prevent mixed raw and non-raw sends
authorTom Caputi <tcaputi@datto.com>
Mon, 4 Feb 2019 19:24:55 +0000 (14:24 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 13 Mar 2019 18:00:43 +0000 (11:00 -0700)
commitf00ab3f22cc2c7f62cfd56be842945667b1d558f
tree1982f7f27afc2209153f79fa3d43cf5706183a9f
parent579ce7c5ae65e670496d41957f63352cb3f0d298
Detect and prevent mixed raw and non-raw sends

Currently, there is an issue in the raw receive code where
raw receives are allowed to happen on top of previously
non-raw received datasets. This is a problem because the
source-side dataset doesn't know about how the blocks on
the destination were encrypted. As a result, any MAC in
the objset's checksum-of-MACs tree that is a parent of both
blocks encrypted on the source and blocks encrypted by the
destination will be incorrect. This will result in
authentication errors when we decrypt the dataset.

This patch fixes this issue by adding a new check to the
raw receive code. The code now maintains an "IVset guid",
which acts as an identifier for the set of IVs used to
encrypt a given snapshot. When a snapshot is raw received,
the destination snapshot will take this value from the
DRR_BEGIN payload. Non-raw receives and normal "zfs snap"
operations will cause ZFS to generate a new IVset guid.
When a raw incremental stream is received, ZFS will check
that the "from" IVset guid in the stream matches that of
the "from" destination snapshot. If they do not match, the
code will error out the receive, preventing the problem.

This patch requires an on-disk format change to add the
IVset guids to snapshots and bookmarks. As a result, this
patch has errata handling and a tunable to help affected
users resolve the issue with as little interruption as
possible.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #8308
27 files changed:
cmd/zpool/zpool_main.c
include/sys/dmu_recv.h
include/sys/dsl_crypt.h
include/sys/dsl_dataset.h
include/sys/fs/zfs.h
lib/libzfs/libzfs_iter.c
lib/libzfs/libzfs_sendrecv.c
lib/libzfs_core/libzfs_core.c
man/man8/zfs.8
module/zcommon/zfeature_common.c
module/zcommon/zfs_prop.c
module/zfs/dmu_recv.c
module/zfs/dmu_send.c
module/zfs/dsl_bookmark.c
module/zfs/dsl_crypt.c
module/zfs/dsl_dataset.c
module/zfs/spa.c
module/zfs/zcp_get.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/missing_ivset.dat.bz2 [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/rsend/Makefile.am
tests/zfs-tests/tests/functional/rsend/send_mixed_raw.ksh [new file with mode: 0755]