linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/2] btrfs: Enhance btrfs handling compression and
Date: Tue, 15 May 2018 15:36:20 +0800	[thread overview]
Message-ID: <20180515073622.18732-1-wqu@suse.com> (raw)

James Harvey reported one corruption where lzo compressed extent without
data csum is causing "decompress failed" kernel message, and then
serious random kernel memory corruption.

For the "decrompress failed" kernel message, it's indeed corrupted
compressed data.
However we can still harden btrfs lzo callers by do extra check on the
lzo compressed data before really decompress it.
It's done mostly based on the total length recorded in the first 4 bytes
of a compressed extent.

It should catch such corruption early.
However the random kernel memory corruption still can't be reproduced
even with the same binary dump.

On the other hand, even btrfs(5) only specifies that nodatacow or
nodatasum will disable compression, it should also work on the same
inode flags level.
For NODATACOW, it's working as epxected, but for NODATASUM alone, it's
not working properly, the 2nd patch will enhance such check so even for
NODATASUM inode, compressio will also be disabled.

Qu Wenruo (2):
  btrfs: inode: Don't compress if NODATASUM or NODATACOW set
  btrfs: lzo: Avoid decompressing obviously corrupted data

 fs/btrfs/compression.h | 1 +
 fs/btrfs/inode.c       | 8 ++++++++
 fs/btrfs/lzo.c         | 4 ++++
 3 files changed, 13 insertions(+)

-- 
2.17.0


             reply	other threads:[~2018-05-15  7:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15  7:36 Qu Wenruo [this message]
2018-05-15  7:36 ` [PATCH 1/2] btrfs: inode: Don't compress if NODATASUM or NODATACOW set Qu Wenruo
2018-05-15  8:21   ` Nikolay Borisov
2018-05-15  8:30     ` Qu Wenruo
2018-05-15  8:35       ` Nikolay Borisov
2018-05-15  8:48         ` Qu Wenruo
2018-05-15 10:36           ` Nikolay Borisov
2018-05-15 10:48             ` Qu Wenruo
2019-06-25  8:24   ` Qu Wenruo
2019-06-27 14:58     ` David Sterba
2019-06-28  1:26       ` Qu Wenruo
2019-06-28 11:34         ` David Sterba
2019-06-28 12:09           ` Qu Wenruo
2019-06-28 16:38             ` David Sterba
2019-06-28  2:47       ` Anand Jain
2019-06-28  5:58         ` Qu Wenruo
2019-06-28  6:56           ` Anand Jain
2019-06-28  7:09             ` Qu Wenruo
2018-05-15  7:36 ` [PATCH 2/2] btrfs: lzo: Avoid decompressing obviously corrupted data Qu Wenruo
2018-05-15  8:05   ` Nikolay Borisov
2018-05-15  8:32     ` Qu Wenruo
2018-05-15  8:34       ` Nikolay Borisov

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=20180515073622.18732-1-wqu@suse.com \
    --to=wqu@suse.com \
    --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;
as well as URLs for NNTP newsgroup(s).