Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754163AbdLHOd0 convert rfc822-to-8bit (ORCPT ); Fri, 8 Dec 2017 09:33:26 -0500 Received: from smtp-out6.electric.net ([192.162.217.192]:51159 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753567AbdLHOdV (ORCPT ); Fri, 8 Dec 2017 09:33:21 -0500 From: David Laight To: "'Michael Ellerman'" , Matthew Wilcox , Kees Cook CC: Cyril Hrubis , Michal Hocko , "Linux API" , Khalid Aziz , "Andrew Morton" , Russell King - ARM Linux , Andrea Arcangeli , Linux-MM , LKML , linux-arch , Florian Weimer , "John Hubbard" , Abdul Haleem , Joel Stanley , Pavel Machek Subject: RE: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE Thread-Topic: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE Thread-Index: AQHTcBToeftCq2PIjEq6x0rvEKXBQaM5ghnQ Date: Fri, 8 Dec 2017 14:33:35 +0000 Message-ID: <0b0bd6862e3a47728c8f658c8a6b3dea@AcuMS.aculab.com> References: <20171129144219.22867-1-mhocko@kernel.org> <20171130065835.dbw4ajh5q5whikhf@dhcp22.suse.cz> <20171201152640.GA3765@rei> <87wp20e9wf.fsf@concordia.ellerman.id.au> <20171206045433.GQ26021@bombadil.infradead.org> <20171206070355.GA32044@bombadil.infradead.org> <87bmjbks4c.fsf@concordia.ellerman.id.au> <20171207195727.GA26792@bombadil.infradead.org> <87shclh3zc.fsf@concordia.ellerman.id.au> In-Reply-To: <87shclh3zc.fsf@concordia.ellerman.id.au> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 673 Lines: 21 From: Michael Ellerman > Sent: 08 December 2017 11:08 ... > If we had a time machine, the right set of flags would be: > > - MAP_FIXED: don't treat addr as a hint, fail if addr is not free > - MAP_REPLACE: replace an existing mapping (or force or clobber) > > But the two were conflated for some reason in the current MAP_FIXED. Possibly because the original use was loading overlays? > Given we can't go back and fix it, the closest we can get is to add a > variant of MAP_FIXED which subtracts the "REPLACE" semantic. > > ie: MAP_FIXED_NOREPLACE Much better than _SAFE - which is always bad because it is usually one 'safe' for one specific use case. David