Re: [PATCH] mm/memory.c: do_fault: avoid usage of stale vm_area_struct

2019-03-02 Thread Jan Stancek
- Original Message - > On Sat, Mar 02, 2019 at 04:11:26PM +0100, Jan Stancek wrote: > > Problem is that "vmf->vma" used in do_fault() can become stale. > > Because mmap_sem may be released, other threads can come in, > > call munmap() and cause "vma" be returned to kmem cache, and > > ge

Re: [PATCH] mm/memory.c: do_fault: avoid usage of stale vm_area_struct

2019-03-02 Thread Matthew Wilcox
On Sat, Mar 02, 2019 at 04:11:26PM +0100, Jan Stancek wrote: > Problem is that "vmf->vma" used in do_fault() can become stale. > Because mmap_sem may be released, other threads can come in, > call munmap() and cause "vma" be returned to kmem cache, and > get zeroed/re-initialized and re-used: > Th

[PATCH] mm/memory.c: do_fault: avoid usage of stale vm_area_struct

2019-03-02 Thread Jan Stancek
LTP testcase mtest06 [1] can trigger a crash on s390x running 5.0.0-rc8. This is a stress test, where one thread mmaps/writes/munmaps memory area and other thread is trying to read from it: CPU: 0 PID: 2611 Comm: mmap1 Not tainted 5.0.0-rc8+ #51 Hardware name: IBM 2964 N63 400 (z/VM 6.4.0) K