Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • kernel
  • fork.c
Find file BlameHistoryPermalink
  • Liam R. Howlett's avatar
    mm: enable maple tree RCU mode by default · 3dd44325
    Liam R. Howlett authored Feb 27, 2023
    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
    will return the expected result.
    
    [Liam.Howlett@Oracle.com: we don't need to free the nodes with RCU[
    Link: https://lore.kernel.org/linux-mm/000000000000b0a65805f663ace6@google.com/
    Link: https://lkml.kernel.org/r/20230227173632.3292573-9-surenb@google.com
    Fixes: d4af56c5
    
     ("mm: start tracking VMAs with maple tree")
    Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
    Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
    Reported-by: default avatar <syzbot+8d95422d3537159ca390@syzkaller.appspotmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    3dd44325
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7