lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230327194358.so2wrir277l5phlm@revolver>
Date:   Mon, 27 Mar 2023 15:43:58 -0400
From:   "Liam R. Howlett" <Liam.Howlett@...cle.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
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>, stable@...r.kernel.org,
        syzbot+8d95422d3537159ca390@...kaller.appspotmail.com
Subject: Re: [PATCH 8/8] mm: enable maple tree RCU mode by default.

* Andrew Morton <akpm@...ux-foundation.org> [230327 15:38]:
> 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?

Yes, this is not necessary.  The scope of this tree is limited to the
function do_vmi_align_munmap() and so we don't need to free the nodes
with RCU.

Thanks,
Liam

> 
> --- 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ