public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: fix logical_to_ino panic in btrfs_map_bio
@ 2023-05-30 19:22 Boris Burkov
  2023-05-30 19:22 ` [PATCH 1/2] btrfs: warn on invalid slot in tree mod log rewind Boris Burkov
  2023-05-30 19:22 ` [PATCH 2/2] btrfs: insert tree mod log move in push_node_left Boris Burkov
  0 siblings, 2 replies; 6+ messages in thread
From: Boris Burkov @ 2023-05-30 19:22 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

The gory details are in the second patch, but it is possible to panic the kernel by running the ioctl BTRFS_IOC_LOGICAL_INO (and V2 of that ioctl).

The TL;DR of the problem is that we do not properly handle logging a move from a push_node_left btree balancing operation in the tree mod log, so it is possible for backref walking using the tree mod log to construct an invalid extent_buffer and ultimately try to map invalid bios for block 0 which ultimately hits a null pointer error and panics.

The patch set introduces additional bookkeeping in tree mod log to WARN on this issue and also fixes the issue itself.

Boris Burkov (2):
  btrfs: warn on invalid slot in tree mod log rewind
  btrfs: insert tree mod log move in push_node_left

 fs/btrfs/ctree.c        | 19 +++++----
 fs/btrfs/tree-mod-log.c | 92 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 93 insertions(+), 18 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2023-05-31 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 19:22 [PATCH 0/2] btrfs: fix logical_to_ino panic in btrfs_map_bio Boris Burkov
2023-05-30 19:22 ` [PATCH 1/2] btrfs: warn on invalid slot in tree mod log rewind Boris Burkov
2023-05-31 12:37   ` Filipe Manana
2023-05-31 14:51     ` Boris Burkov
2023-05-30 19:22 ` [PATCH 2/2] btrfs: insert tree mod log move in push_node_left Boris Burkov
2023-05-31 12:53   ` Filipe Manana

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