Received: by 10.223.164.202 with SMTP id h10csp374103wrb; Mon, 13 Nov 2017 07:49:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMbaeqMzVWhMRpQ/JkpR4847NZHgS6FQCuMHKZImslvOm22MrOgrhiqp1KkFVoR+BYEf+XNY X-Received: by 10.99.144.68 with SMTP id a65mr9365336pge.429.1510588167855; Mon, 13 Nov 2017 07:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510588167; cv=none; d=google.com; s=arc-20160816; b=IMBMnsditscgg5DnYAMy0W0aknlnpwylzMJsg0qDY44EuLTeQkhN60aaRJ9xi+x8Wp L7ovLeS4N22XvfhWU7pKezz68pf3eC5ITSKiMT8M3Yo+4fhSfs9CuLmXFSbt/PB8b+NT 0DnbQBpgGM0mqbYv077QM/wk7agAb4UawjTcen43d5vJ4zalJGcqknoqUbyBtVdjONRq 5nzgSfkxGaOXkPd1X8FIXCvvxbgdCyIXcbgZwpDgXtATDE0GkXGhZpUNG4s4LIiTE2NJ hPMtNYelsgTXwfA4uGO9kk5qxML7miLtY1rYDAJaFswrTLYlqVnXDlcHlEbVZMM+2dvE agJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=3dbHJRuQje94EUEDpm9Mj0JLrfq+QdV2otgWOjClzJQ=; b=v/lPu6vFr2v1+iW1yLVRKcPyO3efR2SPOY7MYKQq+UJgpeIZeNTQYJj0SwJCfyqDyu 93NSEjeyHEdei/9gUh4N5fYB/TWefyR3X61oVheuFCTT5AWu9VfTm7Y53cuvccMVA8DZ nFCfj8KzOJ/PwFsGpXdKcMKn6UjSaF3iihDnffknozBDMk46VrQgkKUMr8WonPzsr9fl TyIyMpL//JjeBeJYpiZbKV4s1AMWpFmvBcjpiF/DpW3Q/l/AmN6SxMrDRU8XYs3ZoEvf 5h1JN+qoDk/GZWkanBHuKWICCJm8sUwXSbUJlQ7LRjIh+16PvQL1EFPy5yU3gNMoiY7u tS/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=CCeN+mh2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si14025035pgr.414.2017.11.13.07.49.15; Mon, 13 Nov 2017 07:49:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=CCeN+mh2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753415AbdKMPsm (ORCPT + 88 others); Mon, 13 Nov 2017 10:48:42 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:53894 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753148AbdKMPsk (ORCPT ); Mon, 13 Nov 2017 10:48:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=3dbHJRuQje94EUEDpm9Mj0JLrfq+QdV2otgWOjClzJQ=; b=CCeN+mh22cIPwatQ56AJSncUGBq67/Q3fVWjKsma+z0+DfvBKiAyCoRbump5FlL+2rTvr65qD1QuhmhEtbN433mqOe5KUIdCT2caZsv04ue2fiQdRUl8MyWfB/aOLSRTFlGqeV6kagPjz5FTr88/5mPvIIixr0X1kqr2Y6zWCMk=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:40205) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1eEGyA-0005gw-At; Mon, 13 Nov 2017 15:48:18 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1eEGy6-0006EU-7P; Mon, 13 Nov 2017 15:48:14 +0000 Date: Mon, 13 Nov 2017 15:48:13 +0000 From: Russell King - ARM Linux To: Michal Hocko Cc: Michael Ellerman , Joel Stanley , Stephen Rothwell , Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List , Benjamin Herrenschmidt , Abdul Haleem , Ralf Baechle , "James E.J. Bottomley" , Helge Deller , Yoshinori Sato , Rich Felker , "David S. Miller" , Chris Zankel , Max Filippov , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org Subject: Re: linux-next: Tree for Nov 7 Message-ID: <20171113154811.GM12318@n2100.armlinux.org.uk> References: <20171107162217.382cd754@canb.auug.org.au> <20171108142050.7w3yliulxjeco3b7@dhcp22.suse.cz> <20171110123054.5pnefm3mczsfv7bz@dhcp22.suse.cz> <20171113092006.cjw2njjukt6limvb@dhcp22.suse.cz> <20171113094203.aofz2e7kueitk55y@dhcp22.suse.cz> <87lgjawgx1.fsf@concordia.ellerman.id.au> <20171113120057.555mvrs4fjq5tyng@dhcp22.suse.cz> <20171113151641.yfqrecpcxllpn5mq@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171113151641.yfqrecpcxllpn5mq@dhcp22.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 13, 2017 at 04:16:41PM +0100, Michal Hocko wrote: > On Mon 13-11-17 13:00:57, Michal Hocko wrote: > [...] > > Yes, I have mentioned that in the previous email but the amount of code > > would be even larger. Basically every arch which reimplements > > arch_get_unmapped_area would have to special case new MAP_FIXED flag to > > do vma lookup. > > It turned out that this might be much more easier than I thought after > all. It seems we can really handle that in the common code. This would > mean that we are exposing a new functionality to the userspace though. > Myabe this would be useful on its own though. Just a quick draft (not > even compile tested) whether this makes sense in general. I would be > worried about unexpected behavior when somebody set other bit without a > good reason and we might fail with ENOMEM for such a call now. > > Elf loader would then use MAP_FIXED_SAFE rather than MAP_FIXED. > --- > diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h > index 3b26cc62dadb..d021c21f9b01 100644 > --- a/arch/alpha/include/uapi/asm/mman.h > +++ b/arch/alpha/include/uapi/asm/mman.h > @@ -31,6 +31,9 @@ > #define MAP_STACK 0x80000 /* give out an address that is best suited for process/thread stacks */ > #define MAP_HUGETLB 0x100000 /* create a huge page mapping */ > > +#define MAP_KEEP_MAPPING 0x2000000 > +#define MAP_FIXED_SAFE MAP_FIXED|MAP_KEEP_MAPPING /* enforce MAP_FIXED without clobbering an existing mapping */ A few things... 1. Does this need to be exposed to userland? 2. Can it end up in include/uapi/asm-generic/mman*.h ? 3. The definition of MAP_FIXED_SAFE should really have parens around it. > @@ -1365,6 +1365,13 @@ unsigned long do_mmap(struct file *file, unsigned long addr, > if (offset_in_page(addr)) > return addr; > > + if ((flags & MAP_FIXED_SAFE) == MAP_FIXED_SAFE) { I'm surprised this doesn't warn - since this effectively expands to: flags & MAP_FIXED | MAP_KEEP_MAPPING hence why MAP_FIXED_SAFE needs parens. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up From 1583965440933608705@xxx Mon Nov 13 15:32:39 +0000 2017 X-GM-THRID: 1583423641769727671 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread