summaryrefslogtreecommitdiff
path: root/internal/contentenc
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-28 20:05:57 +0200
committerJakob Unterwurzacher2016-10-28 21:18:36 +0200
commit012152f3d1f111541f2fbb4c1e65c91243cd6bde (patch)
tree453a9eb72bec16575f0dc5c8a8b45fa52d1107ca /internal/contentenc
parent4cc64c2c9579283da6a997c425e986dfe014c56d (diff)
fusefrontend: I/O error instead of panic on all-zero nonce
Running xfstests generic/075 on tmpfs often triggered a panic for what seems to be a tmpfs bug. Quoting from the email to lkml, http://www.spinics.net/lists/kernel/msg2370127.html : tmpfs seems to be incorrectly returning 0-bytes when reading from a file that is concurrently being truncated.
Diffstat (limited to 'internal/contentenc')
-rw-r--r--internal/contentenc/content.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go
index dd3b77a..c42a844 100644
--- a/internal/contentenc/content.go
+++ b/internal/contentenc/content.go
@@ -113,7 +113,10 @@ func (be *ContentEnc) DecryptBlock(ciphertext []byte, blockNo uint64, fileID []b
// Extract nonce
nonce := ciphertext[:be.cryptoCore.IVLen]
if bytes.Equal(nonce, be.allZeroNonce) {
- panic("Hit an all-zero nonce. This MUST NOT happen!")
+ // Bug in tmpfs?
+ // https://github.com/rfjakob/gocryptfs/issues/56
+ // http://www.spinics.net/lists/kernel/msg2370127.html
+ return nil, errors.New("all-zero nonce")
}
ciphertextOrig := ciphertext
ciphertext = ciphertext[be.cryptoCore.IVLen:]