mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
UPSTREAM: mm: mark VMA as being written when changing vm_flags
Updates to vm_flags have to be done with VMA marked as being written for
preventing concurrent page faults or other modifications.
Link: https://lkml.kernel.org/r/20230227173632.3292573-14-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit c732293331)
Bug: 161210518
Change-Id: Idb88e77475a5b09425e80d5970e8f543fb7640b1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
a9ea3113d4
commit
6764412400
@@ -727,28 +727,28 @@ static inline void vm_flags_init(struct vm_area_struct *vma,
|
||||
static inline void vm_flags_reset(struct vm_area_struct *vma,
|
||||
vm_flags_t flags)
|
||||
{
|
||||
mmap_assert_write_locked(vma->vm_mm);
|
||||
vma_start_write(vma);
|
||||
vm_flags_init(vma, flags);
|
||||
}
|
||||
|
||||
static inline void vm_flags_reset_once(struct vm_area_struct *vma,
|
||||
vm_flags_t flags)
|
||||
{
|
||||
mmap_assert_write_locked(vma->vm_mm);
|
||||
vma_start_write(vma);
|
||||
WRITE_ONCE(ACCESS_PRIVATE(vma, __vm_flags), flags);
|
||||
}
|
||||
|
||||
static inline void vm_flags_set(struct vm_area_struct *vma,
|
||||
vm_flags_t flags)
|
||||
{
|
||||
mmap_assert_write_locked(vma->vm_mm);
|
||||
vma_start_write(vma);
|
||||
ACCESS_PRIVATE(vma, __vm_flags) |= flags;
|
||||
}
|
||||
|
||||
static inline void vm_flags_clear(struct vm_area_struct *vma,
|
||||
vm_flags_t flags)
|
||||
{
|
||||
mmap_assert_write_locked(vma->vm_mm);
|
||||
vma_start_write(vma);
|
||||
ACCESS_PRIVATE(vma, __vm_flags) &= ~flags;
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ static inline void __vm_flags_mod(struct vm_area_struct *vma,
|
||||
static inline void vm_flags_mod(struct vm_area_struct *vma,
|
||||
vm_flags_t set, vm_flags_t clear)
|
||||
{
|
||||
mmap_assert_write_locked(vma->vm_mm);
|
||||
vma_start_write(vma);
|
||||
__vm_flags_mod(vma, set, clear);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user