From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eugene Syromiatnikov Subject: Re: [RFC PATCH v4 24/27] mm/mmap: Create a guard area between VMAs Date: Wed, 3 Oct 2018 18:32:26 +0200 Message-ID: <20181003163226.GC9449@asgard.redhat.com> References: <20180921150351.20898-1-yu-cheng.yu@intel.com> <20180921150351.20898-25-yu-cheng.yu@intel.com> <20181003045611.GB22724@asgard.redhat.com> <5ddb0ad33298d1858e530fce9c9ea2788b2fac81.camel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <5ddb0ad33298d1858e530fce9c9ea2788b2fac81.camel@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Yu-cheng Yu Cc: Andy Lutomirski , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H. J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg List-Id: linux-arch.vger.kernel.org On Wed, Oct 03, 2018 at 09:00:04AM -0700, Yu-cheng Yu wrote: > On Tue, 2018-10-02 at 22:36 -0700, Andy Lutomirski wrote: > > On Tue, Oct 2, 2018 at 9:55 PM Eugene Syromiatnikov wrote: > > > > > > On Fri, Sep 21, 2018 at 08:03:48AM -0700, Yu-cheng Yu wrote: > > > > Create a guard area between VMAs, to detect memory corruption. > > > > > > Do I understand correctly that with this patch a user space program > > > no longer be able to place two mappings back to back? If it is so, > > > it will likely break a lot of things; for example, it's a common ring > > > buffer implementations technique, to map buffer memory twice back > > > to back in order to avoid special handling of items wrapping its end. > > > > I haven't checked what the patch actually does, but it shouldn't have > > any affect on MAP_FIXED or the new no-replace MAP_FIXED variant. > > > > --Andy > > I did some mmap tests with/without MAP_FIXED, and it works as intended. > In addition to the ring buffer, are there other test cases? Right, after some more code reading I figured out that it indeed shouldn't affect MAP_FIXED, thank you for confirmation. I'm not sure, however, whether such a change that provides no ability to configure or affect it will go well with all the supported architectures. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:51848 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbeJCXVS (ORCPT ); Wed, 3 Oct 2018 19:21:18 -0400 Date: Wed, 3 Oct 2018 18:32:26 +0200 From: Eugene Syromiatnikov Subject: Re: [RFC PATCH v4 24/27] mm/mmap: Create a guard area between VMAs Message-ID: <20181003163226.GC9449@asgard.redhat.com> References: <20180921150351.20898-1-yu-cheng.yu@intel.com> <20180921150351.20898-25-yu-cheng.yu@intel.com> <20181003045611.GB22724@asgard.redhat.com> <5ddb0ad33298d1858e530fce9c9ea2788b2fac81.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ddb0ad33298d1858e530fce9c9ea2788b2fac81.camel@intel.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Yu-cheng Yu Cc: Andy Lutomirski , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H. J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , "Shanbhogue, Vedvyas" Message-ID: <20181003163226.uwv46aWj9HG--cTKQBWg4ORLQAinh5x3K5aIcs-LP9s@z> On Wed, Oct 03, 2018 at 09:00:04AM -0700, Yu-cheng Yu wrote: > On Tue, 2018-10-02 at 22:36 -0700, Andy Lutomirski wrote: > > On Tue, Oct 2, 2018 at 9:55 PM Eugene Syromiatnikov wrote: > > > > > > On Fri, Sep 21, 2018 at 08:03:48AM -0700, Yu-cheng Yu wrote: > > > > Create a guard area between VMAs, to detect memory corruption. > > > > > > Do I understand correctly that with this patch a user space program > > > no longer be able to place two mappings back to back? If it is so, > > > it will likely break a lot of things; for example, it's a common ring > > > buffer implementations technique, to map buffer memory twice back > > > to back in order to avoid special handling of items wrapping its end. > > > > I haven't checked what the patch actually does, but it shouldn't have > > any affect on MAP_FIXED or the new no-replace MAP_FIXED variant. > > > > --Andy > > I did some mmap tests with/without MAP_FIXED, and it works as intended. > In addition to the ring buffer, are there other test cases? Right, after some more code reading I figured out that it indeed shouldn't affect MAP_FIXED, thank you for confirmation. I'm not sure, however, whether such a change that provides no ability to configure or affect it will go well with all the supported architectures.