From: Roman Mamedov <rm@romanrm.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: csum errors on top of dm-crypt
Date: Fri, 4 Aug 2017 13:32:46 +0500 [thread overview]
Message-ID: <20170804133246.210c09b1@natsu> (raw)
In-Reply-To: <20170804124444.6d102183@natsu>
On Fri, 4 Aug 2017 12:44:44 +0500
Roman Mamedov <rm@romanrm.net> wrote:
> > What is 0x98f94189, is it not a csum of a block of zeroes by any chance?
>
> It does seem to be something of that sort
Actually, I think I know what happened.
I used "dd bs=1M conv=sparse" to copy source FS onto a LUKS device, which
skipped copying 1M-sized areas of zeroes from the source device by seeking
over those areas on the destination device.
This only works OK if the destination device is entirely zeroed beforehand.
But I also use --allow-discards for the LUKS device; so it may be that after a
discard passthrough to the underlying SSD, which will then return zeroes for
discarded areas, LUKS will not take care to pass zeroes back "upwards" when
reading from those areas, instead it may attempt to decrypt them with its
crypto process, making them read back to userspace as random data.
So after an initial TRIM the destination crypto device was not actually zeroed,
far from it. :)
As a result, every large non-sparse file with at least 1MB-long run of zeroes
in it (those sqlite ones appear to fit the bill) was not written out entirely
onto the destination device by dd, and the intended zero areas were left full
of crypto-randomness instead.
Sorry for the noise, I hope at least this catch was somewhat entertaining.
And Btrfs saves the day once again. :)
--
With respect,
Roman
next prev parent reply other threads:[~2017-08-04 8:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 7:18 csum errors on top of dm-crypt Roman Mamedov
2017-08-04 7:44 ` SQLite " Roman Mamedov
2017-08-04 8:32 ` Roman Mamedov [this message]
2017-08-04 10:09 ` Duncan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170804133246.210c09b1@natsu \
--to=rm@romanrm.net \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox