lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190302171043.GP11592@bombadil.infradead.org>
Date:   Sat, 2 Mar 2019 09:10:43 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     Jan Stancek <jstancek@...hat.com>
Cc:     linux-mm@...ck.org, akpm@...ux-foundation.org,
        peterz@...radead.org, riel@...riel.com, mhocko@...e.com,
        ying.huang@...el.com, jrdr.linux@...il.com, jglisse@...hat.com,
        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

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.

ie I would drop these lines:

> +	mmgrab(vm_mm);
> +
...
> +
> +	mmdrop(vm_mm);
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ