From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 0EF486B0003 for ; Fri, 12 Oct 2018 06:23:29 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id y86-v6so11108888pff.6 for ; Fri, 12 Oct 2018 03:23:29 -0700 (PDT) Received: from ozlabs.org (ozlabs.org. [203.11.71.1]) by mx.google.com with ESMTPS id g79-v6si875657pfk.260.2018.10.12.03.23.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Oct 2018 03:23:27 -0700 (PDT) From: Michael Ellerman Subject: Re: [PATCH] mm: don't clobber partially overlapping VMA with MAP_FIXED_NOREPLACE In-Reply-To: References: <20181010152736.99475-1-jannh@google.com> <20181010171944.GJ5873@dhcp22.suse.cz> Date: Fri, 12 Oct 2018 21:23:21 +1100 Message-ID: <87tvlr1n1i.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: Jann Horn , Michal Hocko Cc: Linux-MM , Andrew Morton , Khalid Aziz , Russell King - ARM Linux , Andrea Arcangeli , Florian Weimer , John Hubbard , Matthew Wilcox , abdhalee@linux.vnet.ibm.com, joel@jms.id.au, Kees Cook , jasone@google.com, davidtgoldblatt@gmail.com, trasz@freebsd.org, Anshuman Khandual , Daniel Micay , kernel list Jann Horn writes: > On Wed, Oct 10, 2018 at 7:19 PM Michal Hocko wrote: >> On Wed 10-10-18 17:27:36, Jann Horn wrote: >> > Daniel Micay reports that attempting to use MAP_FIXED_NOREPLACE in an >> > application causes that application to randomly crash. The existing check >> > for handling MAP_FIXED_NOREPLACE looks up the first VMA that either >> > overlaps or follows the requested region, and then bails out if that VMA >> > overlaps *the start* of the requested region. It does not bail out if the >> > VMA only overlaps another part of the requested region. >> >> I do not understand. Could you give me an example? > > Sure. > > ======= > user@debian:~$ cat mmap_fixed_simple.c > #include > #include > #include > #include > #include .. Mind if I turn that into a selftest? cheers