From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: fix btrfs_root_item related memory bugs
Date: Tue, 3 Nov 2026 20:50:02 +1030 [thread overview]
Message-ID: <cover.1793701174.git.wqu@suse.com> (raw)
https://github.com/kdave/btrfs-progs/pull/1201
There is a security researcher, that exposeed a bug in btrfs root item
reading code, and that bug itself is valid.
So here we're fixing it mostly by introducing a dedicated helper to
handle the possible different sizes of btrfs_root_item.
Unfortunately we can not benefit from tree-checker, as a lot of tools
are designed to skip tree-checker, e.g. btrfs-check --repair can repair
certain item size related bugs, so it must skipping tree-checker or it
can not even open the fs.
The first patch is a small fix noticed during development.
The second one is the main fix related to btrfs_root_item reading.
The last one is two minor fixes related to btrfs_root_item writing.
Qu Wenruo (3):
btrfs-progs: return error if btrfs_next_leaf() failed in
do_list_roots()
btrfs-progs: fix root_item reads which can cause memory bugs
btrfs-progs: fix two sites that may write beyond root item size
check/main.c | 57 ++++++++++++++++++++++++++++----------
cmds/inspect-dump-tree.c | 12 +++++---
cmds/restore.c | 18 ++++++++----
kernel-shared/disk-io.c | 21 +++++++++-----
kernel-shared/extent_io.c | 34 +++++++++++++++++++++++
kernel-shared/extent_io.h | 3 ++
kernel-shared/print-tree.c | 16 +++++++++--
kernel-shared/root-tree.c | 8 ++++--
8 files changed, 133 insertions(+), 36 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-03 10:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:20 Qu Wenruo [this message]
2026-11-03 10:20 ` [PATCH 1/3] btrfs-progs: return error if btrfs_next_leaf() failed in do_list_roots() Qu Wenruo
2026-11-03 10:20 ` [PATCH 2/3] btrfs-progs: fix root_item reads which can cause memory bugs Qu Wenruo
2026-11-03 10:20 ` [PATCH 3/3] btrfs-progs: fix two sites that may write beyond root item size Qu Wenruo
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=cover.1793701174.git.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