public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: docs: add warning for btrfs checksum features
@ 2025-11-21  5:03 Qu Wenruo
  2025-11-21  5:17 ` Christoph Anton Mitterer
  0 siblings, 1 reply; 8+ messages in thread
From: Qu Wenruo @ 2025-11-21  5:03 UTC (permalink / raw)
  To: linux-btrfs

The checksum of btrfs, no matter the algorithm utilized, can not provide
any guarantee that the metadata/data is not modified by a malicious
attacker.

And refer end users to fs-verity if they require a strong verification
of a file.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
This also makes me wonder, does it even make any sense to support
SHA256?

I know in the past it is an important step towards write-time dedupe,
but that feature eventually get rejected (and I totally agree the
decision).

And dedupe ioctl is also not utilizing checksum to verify if the content
matches, there is no real user requires cryptographic hash functions.

Which makes SHA256 not only the slowest checksum algorithm, but also the
largest one (takes 8x metadata space compared to CRC32C).

I'd say we should even deprecate SHA256 checksum support.
---
 Documentation/ch-checksumming.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/ch-checksumming.rst b/Documentation/ch-checksumming.rst
index 72261c23fb8c..cc3cb43b175f 100644
--- a/Documentation/ch-checksumming.rst
+++ b/Documentation/ch-checksumming.rst
@@ -3,6 +3,17 @@ writing and verified after reading the blocks from devices. The whole metadata
 block has an inline checksum stored in the b-tree node header. Each data block
 has a detached checksum stored in the checksum tree.

+.. warning::
+   The checksum of btrfs is only to detect which mirrors is good, it can not
+   guarantee the data/metadata is not modified by any malicious attacker, no matter
+   the checksum algorithm utilized.
+
+   The attacker can always modify the file content, update the checksum tree to use
+   a newly calculated checksum.
+
+   For strong verification of read-only files, please use *fs-verity* feature,
+   which btrfs supports since v5.15.
+
 .. note::
    Since a data checksum is calculated just before submitting to the block
    device, btrfs has a strong requirement that the corresponding data block must
--
2.52.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-11-22 14:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21  5:03 [PATCH] btrfs-progs: docs: add warning for btrfs checksum features Qu Wenruo
2025-11-21  5:17 ` Christoph Anton Mitterer
2025-11-21  5:24   ` Qu Wenruo
2025-11-21  6:02     ` Christoph Anton Mitterer
2025-11-21  6:44       ` Qu Wenruo
2025-11-21 23:55         ` Christoph Anton Mitterer
2025-11-22  0:52           ` Eric Biggers
2025-11-22 14:36         ` Neal Gompa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox