Received: by 10.223.164.202 with SMTP id h10csp326681wrb; Tue, 14 Nov 2017 02:05:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ1+/BDSMXtAjZhlKz9XzTPrO/Pv2CRA7tYmDGDvLsPpjuQ9jTpIR+gc9LptRiJXqHQq8TJ X-Received: by 10.84.240.136 with SMTP id z8mr11836135plk.240.1510653934855; Tue, 14 Nov 2017 02:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510653934; cv=none; d=google.com; s=arc-20160816; b=HudoGAx9twqtjvw3qGrwocdN8E0d1g80PtN0M++ijtYKncus2kI5QoUJiQKZh2FGbj 5Wh+k5pWHbVKCKmDzgn10otOPEkWqRQXulA5G0u8B18VVS2yVe4shIBoHeLUq2zLp8sH lDCSbR/wR9IB8EZmKwu2BNFMh+j8/7K/Js3Z/dVWas4sZ3d68p6K7XEKQwAx/zCR7zK8 ljyZ3hGi71wultq04xheMF+Rjh5CqpShngNOAXxfHaiO1bp6oZVEtauBEj0/qdohu7uv +w8AdYiq+zJeCWdNuKIGf834WfZsUL/g+luXy+krtgkVm5ty4diMmRAq2xi3kBd4YdGT +l1A== 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:arc-authentication-results; bh=/+6Kud3HWqkbIAKRxJ3mnIGHeoryJcNcoiJfSrhVjcQ=; b=AIZRHymH4NPWGzrGD7D1Flprs7LsMX92RybLfpagicgEXDFdUWBpMRLhuaLkPdKr8W OI/CVJBBtpn5kmRdga6CV7f4W+QLR4moxqgM7pwjQ2Yrc1J5ABX6PRwyb41WUMtTt6/+ UjJG+fQesFE/nmvJXZl50yZWo/wn1ZqOuUsX7Gmzdr8IwLB0Wxd1cFF0JXw73u5PG10x Qo0PQcWmbVXxWF4DWvMkNP1nuCOh9X9VauhcAqzlAZ4l02pk4yO6KUtlIfkU0U5PbWuR BejIq2F302e6+VMvCRPrDEXcIJEd092bUYQRbZywUIvYXMMWyDhxb3QCtbJdT99B7z4X Rbsw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si5841057plt.229.2017.11.14.02.05.22; Tue, 14 Nov 2017 02:05:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753699AbdKNJ31 (ORCPT + 87 others); Tue, 14 Nov 2017 04:29:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:44192 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752319AbdKNJ3T (ORCPT ); Tue, 14 Nov 2017 04:29:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 634C6AAB5; Tue, 14 Nov 2017 09:29:17 +0000 (UTC) Date: Tue, 14 Nov 2017 10:29:16 +0100 From: Michal Hocko To: Michael Ellerman Cc: Joel Stanley , Stephen Rothwell , Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List , Russell King , 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: <20171114092916.ho5mvwc23xnelmod@dhcp22.suse.cz> References: <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> <20171113154939.6ui2fmpokpm7g4oj@dhcp22.suse.cz> <20171113160637.jhekbdyfpccme3be@dhcp22.suse.cz> <87a7zpw75f.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a7zpw75f.fsf@concordia.ellerman.id.au> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 14-11-17 20:18:04, Michael Ellerman wrote: > Michal Hocko writes: > > > [Sorry for spamming, this one is the last attempt hopefully] > > > > On Mon 13-11-17 16:49:39, Michal Hocko wrote: > >> On Mon 13-11-17 16:16:41, 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. > >> > >> Hmm, the bigger problem would be the backward compatibility actually. We > >> would get silent corruptions which is exactly what the flag is trying > >> fix. mmap flags handling really sucks. So I guess we would have to make > >> the flag internal only :/ > > > > OK, so this one should take care of the backward compatibility while > > still not touching the arch code > > I'm not sure I understand your worries about backward compatibility? Just imagine you are running an application which uses the new flag combination on an older kernel. You will get no warning, yet you have no way to check that you have actually clobbered an existing mapping because MAP_FIXED will be used the old way. > If we add a new mmap flag which is currently unused then what is the > problem? Are you worried about user code that accidentally passes that > flag already? If we add a completely new flag, like in this patch, then the code using the flag will not clobber an existing mapping on older kernels which do not recognize it (we will simply fall back to the default hint based implementation). You might not get the mapping you asked for which sucks but that is not fixable AFAICS. You can at least do mapped_addr = mmap(addr, ... MAP_FIXED_SAFE...); assert(mapped_addr == addr); So I do not think we can go with the modifier unfortunatelly. -- Michal Hocko SUSE Labs From 1584032639649608050@xxx Tue Nov 14 09:20:44 +0000 2017 X-GM-THRID: 1583423641769727671 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread