linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] RFC: READ/WRITE_ONCE vma/mm cleanups
@ 2019-03-01  3:55 Andrea Arcangeli
  2019-03-01  3:55 ` [PATCH 1/2] coredump: use READ_ONCE to read mm->flags Andrea Arcangeli
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andrea Arcangeli @ 2019-03-01  3:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Hugh Dickins, Kirill A . Shutemov, Michal Hocko

Hello,

This was a well known issue for more than a decade, but until a few
months ago we relied on the compiler to stick to atomic accesses and
updates while walking and updating pagetables.

However now the 64bit native_set_pte finally uses WRITE_ONCE and
gup_pmd_range uses READ_ONCE as well.

This convert more racy VM places to avoid depending on the expected
compiler behavior to achieve kernel runtime correctness.

It mostly guarantees gcc to do atomic updates at 64bit granularity
(practically not needed) and it also prevents gcc to emit code that
risks getting confused if the memory unexpectedly changes under it
(unlikely to ever be needed).

The list of vm_start/end/pgoff to update isn't complete, I covered the
most obvious places, but before wasting too much time at doing a full
audit I thought it was safer to post it and get some comment. More
updates can be posted incrementally anyway.

Andrea Arcangeli (2):
  coredump: use READ_ONCE to read mm->flags
  mm: use READ/WRITE_ONCE to access anonymous vmas
    vm_start/vm_end/vm_pgoff

 fs/coredump.c |  2 +-
 mm/gup.c      | 23 +++++++++++++----------
 mm/internal.h |  3 ++-
 mm/memory.c   |  2 +-
 mm/mmap.c     | 16 ++++++++--------
 mm/rmap.c     |  3 ++-
 mm/vmacache.c |  3 ++-
 7 files changed, 29 insertions(+), 23 deletions(-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-05 13:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-01  3:55 [PATCH 0/2] RFC: READ/WRITE_ONCE vma/mm cleanups Andrea Arcangeli
2019-03-01  3:55 ` [PATCH 1/2] coredump: use READ_ONCE to read mm->flags Andrea Arcangeli
2019-03-01  3:55 ` [PATCH 2/2] mm: use READ/WRITE_ONCE to access anonymous vmas vm_start/vm_end/vm_pgoff Andrea Arcangeli
2019-03-01  9:37 ` [PATCH 0/2] RFC: READ/WRITE_ONCE vma/mm cleanups Kirill A. Shutemov
2019-03-01 13:04   ` Vlastimil Babka
2019-03-01 16:54     ` Andrea Arcangeli
2019-03-01 18:49       ` Davidlohr Bueso
2019-03-04 10:12       ` Kirill A. Shutemov
2019-03-05 13:00         ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).