Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: scrub avoid use-after-free when chunk length is not 64K aligned
@ 2024-01-17  0:32 Qu Wenruo
  2024-01-17  0:32 ` [PATCH v2 1/2] btrfs: scrub: " Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Qu Wenruo @ 2024-01-17  0:32 UTC (permalink / raw)
  To: linux-btrfs

[Changelog]
v2:
- Split out the RST code change
  So that backport can happen more smoothly.
  Furthermore, the RST specific part is really just a small enhancement.
  As RST would always do the btrfs_map_block(), even if we have a
  corrupted extent item beyond chunk, it would be properly caught,
  thus at most false alerts, no real use-after-free can happen after
  the first patch.

- Slight update on the commit message of the first patch
  Fix a copy-and-paste error of the number used to calculate the chunk
  end.
  Remove the RST scrub part, as we won't do any RST fix (although
  it would still sliently fix RST, since both RST and regular scrub
  share the same endio function)

There is a bug report about use-after-free during scrub and crash the
system.
It turns out to be a chunk whose lenght is not 64K aligned causing the
problem.

The first patch would be the proper fix, needs to be backported to all
kernel using newer scrub interface.

The 2nd patch is a small enhancement for RST scrub, inspired by the
above bug, which doesn't really need to be backported.

Qu Wenruo (2):
  btrfs: scrub: avoid use-after-free when chunk length is not 64K
    aligned
  btrfs: scrub: limit RST scrub to chunk boundary

 fs/btrfs/scrub.c | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2024-01-17 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17  0:32 [PATCH v2 0/2] btrfs: scrub avoid use-after-free when chunk length is not 64K aligned Qu Wenruo
2024-01-17  0:32 ` [PATCH v2 1/2] btrfs: scrub: " Qu Wenruo
2024-01-17  0:32 ` [PATCH v2 2/2] btrfs: scrub: limit RST scrub to chunk boundary Qu Wenruo
2024-01-17  7:54 ` [PATCH v2 0/2] btrfs: scrub avoid use-after-free when chunk length is not 64K aligned Johannes Thumshirn
2024-01-17  7:57   ` Qu Wenruo
2024-01-17  8:09     ` Johannes Thumshirn
2024-01-17 17:17       ` David Sterba

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