lkml.org 
[lkml]   [2023]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 5/6] mm: always lock new vma before inserting into vma tree
On Thu, 3 Aug 2023 at 10:27, Suren Baghdasaryan <surenb@google.com> wrote:
>
> While it's not strictly necessary to lock a newly created vma before
> adding it into the vma tree (as long as no further changes are performed
> to it), it seems like a good policy to lock it and prevent accidental
> changes after it becomes visible to the page faults. Lock the vma before
> adding it into the vma tree.

So my main reaction here is that I started to wonder about the vma allocation.

Why doesn't vma_init() do something like

mmap_assert_write_locked(mm);
vma->vm_lock_seq = mm->mm_lock_seq;

and instead we seem to expect vma_lock_alloc() to do this (and do it
very badly indeed).

Strange.

Anyway, this observation was just a reaction to that "not strictly
necessary to lock a newly created vma" part of the commentary. I feel
like we could/should just make sure that all newly created vma's are
always simply created write-locked.

Linus

\
 
 \ /
  Last update: 2023-08-03 20:04    [W:0.120 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site