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: <51E4A719.4020703@redhat.com>
Date:	Mon, 15 Jul 2013 21:51:21 -0400
From:	Rik van Riel <riel@...hat.com>
To:	David Gibson <david@...son.dropbear.id.au>
CC:	Davidlohr Bueso <davidlohr.bueso@...com>,
	Hugh Dickins <hughd@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Michel Lespinasse <walken@...gle.com>,
	Mel Gorman <mgorman@...e.de>,
	Konstantin Khlebnikov <khlebnikov@...nvz.org>,
	Michal Hocko <mhocko@...e.cz>,
	"AneeshKumarK.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Hillf Danton <dhillf@...il.com>, linux-mm@...ck.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/hugetlb: per-vma instantiation mutexes

On 07/15/2013 03:24 AM, David Gibson wrote:
> On Sun, Jul 14, 2013 at 08:16:44PM -0700, Davidlohr Bueso wrote:

>>> Reading the existing comment, this change looks very suspicious to me.
>>> A per-vma mutex is just not going to provide the necessary exclusion, is
>>> it?  (But I recall next to nothing about these regions and
>>> reservations.)
>
> A per-VMA lock is definitely wrong.  I think it handles one form of
> the race, between threads sharing a VM on a MAP_PRIVATE mapping.
> However another form of the race can and does occur between different
> MAP_SHARED VMAs in the same or different processes.  I think there may
> be edge cases involving mremap() and MAP_PRIVATE that will also be
> missed by a per-VMA lock.
>
> Note that the libhugetlbfs testsuite contains tests for both PRIVATE
> and SHARED variants of the race.

Can we get away with simply using a mutex in the file?
Say vma->vm_file->mapping->i_mmap_mutex?

That might help with multiple processes initializing
multiple shared memory segments at the same time, and
should not hurt the case of a process mapping its own
hugetlbfs area.

It might have the potential to hurt when getting private
copies on a MAP_PRIVATE area, though.  I have no idea
how common it is for multiple processes to MAP_PRIVATE
the same hugetlbfs file, though...

-- 
All rights reversed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ