Skip to content

Commit

Permalink
6585 sha512, skein, and edonr have an unenforced dependency on extens…
Browse files Browse the repository at this point in the history
…ible dataset

Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Richard Laager <[email protected]>

In any pool without the extensible dataset feature flag already enabled,
creating a dataset with dedup set to use one of the new checksums would
result in the following panic as soon as any data was added:

panic[cpu0]/thread=ffffff0006761c40: feature_get_refcount(spa, feature,
&refcount) != 48 (0x30 != 0x30), file: ../../common/fs/zfs/zfeature.c
line 390

Inpsection showed that feature->fi_feature was 7, which is the value of
SPA_FEATURE_EXTENSIBLE_DATASET in the spa_feature enum.  This commit
adds extensible dataset as a dependency for the sha512, edonr, and skein
feature flags, which prevents the panic.
  • Loading branch information
ilovezfs committed Feb 16, 2016
1 parent bef06e1 commit b62a652
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 7 deletions.
109 changes: 109 additions & 0 deletions man/man5/zpool-features.5
Original file line number Diff line number Diff line change
Expand Up @@ -432,5 +432,114 @@ set larger than 128KB, and will return to being \fBenabled\fR once all
filesystems that have ever had their recordsize larger than 128KB are destroyed.
.RE

.sp
.ne 2
.na
\fB\fBsha512\fR\fR
.ad
.RS 4n
.TS
l l .
GUID org.illumos:sha512
READ\-ONLY COMPATIBLE no
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the SHA-512/256 truncated hash algorithm
(FIPS 180-4) for checksum and dedup. The native 64-bit arithmetic of
SHA-512 provides an approximate 50% performance boost over SHA-256 on
64-bit hardware and is thus a good minimum-change replacement candidate
for systems where hash performance is important, but these systems
cannot for whatever reason utilize the faster \fBskein\fR and
\fBedonr\fR algorithms.

When the \fBsha512\fR feature is set to \fBenabled\fR, the administrator
can turn on the \fBsha512\fR checksum on any dataset using the
\fBzfs set checksum=sha512\fR(1M) command. This feature becomes
\fBactive\fR once a \fBchecksum\fR property has been set to \fBsha512\fR,
and will return to being \fBenabled\fR once all filesystems that have
ever had their checksum set to \fBsha512\fR are destroyed.

Booting off of pools utilizing SHA-512/256 is supported (provided that
the updated GRUB stage2 module is installed).

.RE

.sp
.ne 2
.na
\fB\fBskein\fR\fR
.ad
.RS 4n
.TS
l l .
GUID org.illumos:skein
READ\-ONLY COMPATIBLE no
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the Skein hash algorithm for checksum
and dedup. Skein is a high-performance secure hash algorithm that was a
finalist in the NIST SHA-3 competition. It provides a very high security
margin and high performance on 64-bit hardware (80% faster than
SHA-256). This implementation also utilizes the new salted checksumming
functionality in ZFS, which means that the checksum is pre-seeded with a
secret 256-bit random key (stored on the pool) before being fed the data
block to be checksummed. Thus the produced checksums are unique to a
given pool, preventing hash collision attacks on systems with dedup.

When the \fBskein\fR feature is set to \fBenabled\fR, the administrator
can turn on the \fBskein\fR checksum on any dataset using the
\fBzfs set checksum=skein\fR(1M) command. This feature becomes
\fBactive\fR once a \fBchecksum\fR property has been set to \fBskein\fR,
and will return to being \fBenabled\fR once all filesystems that have
ever had their checksum set to \fBskein\fR are destroyed.

Booting off of pools using \fBskein\fR is \fBNOT\fR supported
-- any attempt to enable \fBskein\fR on a root pool will fail with an
error.

.RE

.sp
.ne 2
.na
\fB\fBedonr\fR\fR
.ad
.RS 4n
.TS
l l .
GUID org.illumos:edonr
READ\-ONLY COMPATIBLE no
DEPENDENCIES extensible_dataset
.TE

This feature enables the use of the Edon-R hash algorithm for checksum,
including for nopwrite (if compression is also enabled, an overwrite of
a block whose checksum matches the data being written will be ignored).
In an abundance of caution, Edon-R can not be used with dedup
(without verification).

Edon-R is a very high-performance hash algorithm that was part
of the NIST SHA-3 competition. It provides extremely high hash
performance (over 350% faster than SHA-256), but was not selected
because of its unsuitability as a general purpose secure hash algorithm.
This implementation utilizes the new salted checksumming functionality
in ZFS, which means that the checksum is pre-seeded with a secret
256-bit random key (stored on the pool) before being fed the data block
to be checksummed. Thus the produced checksums are unique to a given
pool.

When the \fBedonr\fR feature is set to \fBenabled\fR, the administrator
can turn on the \fBedonr\fR checksum on any dataset using the
\fBzfs set checksum=edonr\fR(1M) command. This feature becomes
\fBactive\fR once a \fBchecksum\fR property has been set to \fBedonr\fR,
and will return to being \fBenabled\fR once all filesystems that have
ever had their checksum set to \fBedonr\fR are destroyed.

Booting off of pools using \fBedonr\fR is \fBNOT\fR supported
-- any attempt to enable \fBedonr\fR on a root pool will fail with an
error.

.SH "SEE ALSO"
\fBzpool\fR(8)
28 changes: 21 additions & 7 deletions module/zfs/zfeature_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,30 @@ zpool_feature_init(void)
"Support for blocks larger than 128KB.",
ZFEATURE_FLAG_PER_DATASET, large_blocks_deps);

static const spa_feature_t sha512_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_SHA512,
"org.illumos:sha512", "sha512",
"SHA-512/256 hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
"org.illumos:sha512", "sha512",
"SHA-512/256 hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, sha512_deps);

static const spa_feature_t skein_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_SKEIN,
"org.illumos:skein", "skein",
"Skein hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
"org.illumos:skein", "skein",
"Skein hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, skein_deps);

static const spa_feature_t edonr_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_EDONR,
"org.illumos:edonr", "edonr",
"Edon-R hash algorithm.",
ZFEATURE_FLAG_PER_DATASET, NULL);
ZFEATURE_FLAG_PER_DATASET, edonr_deps);
}

0 comments on commit b62a652

Please sign in to comment.