All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: fixes for relocation to avoid KASAN reports
@ 2019-12-11  5:00 Qu Wenruo
  2019-12-11  5:00 ` [PATCH 1/3] btrfs: relocation: Fix a KASAN use-after-free bug due to extended reloc tree lifespan Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Qu Wenruo @ 2019-12-11  5:00 UTC (permalink / raw)
  To: linux-btrfs

Due to commit d2311e698578 ("btrfs: relocation: Delay reloc tree
deletion after merge_reloc_roots"), reloc tree lifespan is extended.

Although we always set root->reloc_root to NULL before we drop the reloc
tree, but that's not multi-core safe since we have no proper memory
barrier to ensure other cores can see the same root->reloc_root.

The proper root fix should be some proper root refcount, and make
btrfs_drop_snapshot() to wait for all other root owner to release the
root before dropping it.

But for now, let's just check the DEAD_RELOC_ROOT bit before accessing
root->reloc_root.

Qu Wenruo (3):
  btrfs: relocation: Fix a KASAN use-after-free bug due to extended
    reloc tree lifespan
  btrfs: relocation: Fix KASAN report on create_reloc_tree due to
    extended reloc tree lifepsan
  btrfs: relocation: Fix a KASAN report on btrfs_reloc_pre_snapshot()
    due to extended reloc root lifespan

 fs/btrfs/relocation.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

-- 
2.24.0


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

end of thread, other threads:[~2020-01-06 18:23 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  5:00 [PATCH 0/3] btrfs: fixes for relocation to avoid KASAN reports Qu Wenruo
2019-12-11  5:00 ` [PATCH 1/3] btrfs: relocation: Fix a KASAN use-after-free bug due to extended reloc tree lifespan Qu Wenruo
2019-12-11 14:53   ` Josef Bacik
2019-12-11  5:00 ` [PATCH 2/3] btrfs: relocation: Fix KASAN report on create_reloc_tree due to extended reloc tree lifepsan Qu Wenruo
2019-12-11 14:55   ` Josef Bacik
2019-12-11 15:15     ` David Sterba
2019-12-11  5:00 ` [PATCH 3/3] btrfs: relocation: Fix a KASAN report on btrfs_reloc_pre_snapshot() due to extended reloc root lifespan Qu Wenruo
2019-12-11 14:55   ` Josef Bacik
2019-12-11 15:34 ` [PATCH 0/3] btrfs: fixes for relocation to avoid KASAN reports David Sterba
2019-12-12  0:39   ` Qu Wenruo
2019-12-12 14:28     ` David Sterba
2020-01-03 15:52     ` David Sterba
2020-01-03 16:15       ` David Sterba
2020-01-04  9:37         ` Qu Wenruo
2020-01-04 13:18           ` Qu Wenruo
2020-01-06  7:04         ` Qu Wenruo
2020-01-06 18:23           ` David Sterba
2020-01-04  1:32       ` Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.