From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: References: <150277752553.23945.13932394738552748440.stgit@dwillia2-desk3.amr.corp.intel.com> <150277753660.23945.11500026891611444016.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Tue, 15 Aug 2017 15:31:04 -0700 Message-ID: Subject: Re: [PATCH v4 2/3] mm: introduce MAP_VALIDATE a mechanism for adding new mmap flags Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org To: Andy Lutomirski Cc: "Darrick J. Wong" , Jan Kara , Arnd Bergmann , linux-nvdimm , Linux API , "linux-kernel@vger.kernel.org" , linux-xfs@vger.kernel.org, "linux-mm@kvack.org" , Linux FS Devel , Andrew Morton , Christoph Hellwig List-ID: On Tue, Aug 15, 2017 at 9:28 AM, Andy Lutomirski wrote: > On Mon, Aug 14, 2017 at 11:12 PM, Dan Williams wrote: >> The mmap syscall suffers from the ABI anti-pattern of not validating >> unknown flags. However, proposals like MAP_SYNC and MAP_DIRECT need a >> mechanism to define new behavior that is known to fail on older kernels >> without the feature. Use the fact that specifying MAP_SHARED and >> MAP_PRIVATE at the same time is invalid as a cute hack to allow a new >> set of validated flags to be introduced. > > While this is cute, is it actually better than a new syscall? After playing with MAP_DIRECT defined as (MAP_SHARED|MAP_PRIVATE|0x40) I think a new syscall is better. It's very easy to make the mistake that "MAP_DIRECT" defines a single flag vs representing a multi-bit encoding. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752757AbdHOWbI (ORCPT ); Tue, 15 Aug 2017 18:31:08 -0400 Received: from mail-yw0-f169.google.com ([209.85.161.169]:36858 "EHLO mail-yw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbdHOWbG (ORCPT ); Tue, 15 Aug 2017 18:31:06 -0400 MIME-Version: 1.0 In-Reply-To: References: <150277752553.23945.13932394738552748440.stgit@dwillia2-desk3.amr.corp.intel.com> <150277753660.23945.11500026891611444016.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Tue, 15 Aug 2017 15:31:04 -0700 Message-ID: Subject: Re: [PATCH v4 2/3] mm: introduce MAP_VALIDATE a mechanism for adding new mmap flags To: Andy Lutomirski Cc: "Darrick J. Wong" , Jan Kara , Arnd Bergmann , linux-nvdimm , Linux API , "linux-kernel@vger.kernel.org" , linux-xfs@vger.kernel.org, "linux-mm@kvack.org" , Linux FS Devel , Andrew Morton , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 15, 2017 at 9:28 AM, Andy Lutomirski wrote: > On Mon, Aug 14, 2017 at 11:12 PM, Dan Williams wrote: >> The mmap syscall suffers from the ABI anti-pattern of not validating >> unknown flags. However, proposals like MAP_SYNC and MAP_DIRECT need a >> mechanism to define new behavior that is known to fail on older kernels >> without the feature. Use the fact that specifying MAP_SHARED and >> MAP_PRIVATE at the same time is invalid as a cute hack to allow a new >> set of validated flags to be introduced. > > While this is cute, is it actually better than a new syscall? After playing with MAP_DIRECT defined as (MAP_SHARED|MAP_PRIVATE|0x40) I think a new syscall is better. It's very easy to make the mistake that "MAP_DIRECT" defines a single flag vs representing a multi-bit encoding.