[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <913961507.4507772.1551549609679.JavaMail.zimbra@redhat.com>
Date: Sat, 2 Mar 2019 13:00:09 -0500 (EST)
From: Jan Stancek <jstancek@...hat.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-mm@...ck.org, akpm@...ux-foundation.org,
peterz@...radead.org, riel@...riel.com, mhocko@...e.com,
ying huang <ying.huang@...el.com>,
jrdr linux <jrdr.linux@...il.com>, jglisse@...hat.com,
aneesh kumar <aneesh.kumar@...ux.ibm.com>, david@...hat.com,
aarcange@...hat.com, raquini@...hat.com, rientjes@...gle.com,
kirill@...temov.name, mgorman@...hsingularity.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/memory.c: do_fault: avoid usage of stale
vm_area_struct
----- 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
> > get zeroed/re-initialized and re-used:
>
> > This patch pins mm_struct and stores its value, to avoid using
> > potentially stale "vma" when calling pte_free().
>
> OK, we need to cache the mm_struct, but why do we need the extra atomic op?
> There's surely no way the mm can be freed while the thread is in the middle
> of handling a fault.
You're right, I was needlessly paranoid.
>
> ie I would drop these lines:
I'll send v2.
Thanks,
Jan
>
> > + mmgrab(vm_mm);
> > +
> ...
> > +
> > + mmdrop(vm_mm);
> > +
>
Powered by blists - more mailing lists