[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230327123849.f2b9db25baf367e3c77fe072@linux-foundation.org>
Date: Mon, 27 Mar 2023 12:38:49 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
maple-tree@...ts.infradead.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>,
Suren Baghdasaryan <surenb@...gle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
stable@...r.kernel.org,
syzbot+8d95422d3537159ca390@...kaller.appspotmail.com
Subject: Re: [PATCH 8/8] mm: enable maple tree RCU mode by default.
On Mon, 27 Mar 2023 14:55:32 -0400 "Liam R. Howlett" <Liam.Howlett@...cle.com> wrote:
> Use the maple tree in RCU mode for VMA tracking.
>
> The maple tree tracks the stack and is able to update the pivot
> (lower/upper boundary) in-place to allow the page fault handler to write
> to the tree while holding just the mmap read lock. This is safe as the
> writes to the stack have a guard VMA which ensures there will always be
> a NULL in the direction of the growth and thus will only update a pivot.
>
> It is possible, but not recommended, to have VMAs that grow up/down
> without guard VMAs. syzbot has constructed a testcase which sets up a
> VMA to grow and consume the empty space. Overwriting the entire NULL
> entry causes the tree to be altered in a way that is not safe for
> concurrent readers; the readers may see a node being rewritten or one
> that does not match the maple state they are using.
>
> Enabling RCU mode allows the concurrent readers to see a stable node and
This differs from what had. Intended?
--- a/mm/mmap.c~mm-enable-maple-tree-rcu-mode-by-default-v8
+++ a/mm/mmap.c
@@ -2277,8 +2277,7 @@ do_vmi_align_munmap(struct vma_iterator
int count = 0;
int error = -ENOMEM;
MA_STATE(mas_detach, &mt_detach, 0, 0);
- mt_init_flags(&mt_detach, vmi->mas.tree->ma_flags &
- (MT_FLAGS_LOCK_MASK | MT_FLAGS_USE_RCU));
+ mt_init_flags(&mt_detach, vmi->mas.tree->ma_flags & MT_FLAGS_LOCK_MASK);
mt_set_external_lock(&mt_detach, &mm->mmap_lock);
/*
_
Powered by blists - more mailing lists