mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
4c46b99d24
commit
ae76f45cda
@@ -39,7 +39,7 @@
|
||||
#define DSL_CRYPTO_KEY_HMAC_KEY "DSL_CRYPTO_HMAC_KEY_1"
|
||||
#define DSL_CRYPTO_KEY_ROOT_DDOBJ "DSL_CRYPTO_ROOT_DDOBJ"
|
||||
#define DSL_CRYPTO_KEY_REFCOUNT "DSL_CRYPTO_REFCOUNT"
|
||||
|
||||
#define DSL_CRYPTO_KEY_VERSION "DSL_CRYPTO_VERSION"
|
||||
|
||||
/*
|
||||
* In-memory representation of a wrapping key. One of these structs will exist
|
||||
@@ -169,6 +169,7 @@ int dsl_crypto_params_create_nvlist(dcp_cmd_t cmd, nvlist_t *props,
|
||||
void dsl_crypto_params_free(dsl_crypto_params_t *dcp, boolean_t unload);
|
||||
void dsl_dataset_crypt_stats(struct dsl_dataset *ds, nvlist_t *nv);
|
||||
int dsl_crypto_can_set_keylocation(const char *dsname, const char *keylocation);
|
||||
boolean_t dsl_dir_incompatible_encryption_version(dsl_dir_t *dd);
|
||||
|
||||
void spa_keystore_init(spa_keystore_t *sk);
|
||||
void spa_keystore_fini(spa_keystore_t *sk);
|
||||
|
||||
Reference in New Issue
Block a user