Received: by 10.223.164.202 with SMTP id h10csp649126wrb; Fri, 17 Nov 2017 06:32:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMb9SYqYEkCok9AlZVwihl5HnYBXrBF0zZxFCdaqma4P6qNCTLWUJ7fPbdLaW3Y7/xMqqW0F X-Received: by 10.99.117.74 with SMTP id f10mr5307404pgn.27.1510929153777; Fri, 17 Nov 2017 06:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929153; cv=none; d=google.com; s=arc-20160816; b=jix4C/POOXoa2Gqf5KXCFNT8lhcDBbTqNASdGflK9jUbJzAmvtADVeXerD5177w5QZ 7nqBBgNyUXLcdmQPGY4fkAjL7C0GPD+Jf19AAUpjG/7p8w45ETyQu5+bhmQvU431XNLJ 6Io6+0/C1ye6iJPjMYEvzma4TElCdy+CEiihGhD2C4x5OJfBs3RhLIIpBeYLaMS0KdcF m2PKvGNytGEginotvUuCTLqMCLPMoQMXiKGweN1Fa/weyCA7v4BI0/ZQ6HekhPC/Du9o oA/p4xmQZt7VFc9F2nyePgJptLmsKF76Ntz6uJWameIe5Ff3nlKKXBmQSmOhHeHhCt5g /a6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=URh8hJnB3M7V/TAuTjskecgjIy5eyfet6UbLKzZHE9U=; b=yUeVJj46yHgfn1JsLeC1mDDtHseELxJXkLRzrSXRJ32SoK3O3z1UH9rVXmYGHILaCW V8DVqD5Eac7SLMagHMd+VSlrsA1f6UBNaaUyesbza+lFz7v8evyKuw8mBT6xEcs6SOzz 4OEv0tYeSoDN7ZnxdR05o/Jfvj1Mfc3NiVsL3OpRpQNB3rt+OxAKjZLxad/8b0R78GOl bdnRlNubeP/ZGktdm0snnsjDGehmwWQJbaaVpEqG6jwm9ebhUgTT+7fSSPn5Yujm2Z1m fsG/x9Jdbb6I772VkDpp1UsnGZSVcVNNvs09S5La/H2D2UICcypySXNG3Cecgi15NXWn HPrQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si2831737pli.826.2017.11.17.06.32.11; Fri, 17 Nov 2017 06:32:33 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934225AbdKQHbG (ORCPT + 91 others); Fri, 17 Nov 2017 02:31:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39284 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933991AbdKQHa5 (ORCPT ); Fri, 17 Nov 2017 02:30:57 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99DBD7E422; Fri, 17 Nov 2017 07:30:57 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B58913CA8D; Fri, 17 Nov 2017 07:30:54 +0000 (UTC) Subject: Re: [RFC PATCH 1/2] mm: introduce MAP_FIXED_SAFE To: Michal Hocko , linux-api@vger.kernel.org Cc: Khalid Aziz , Michael Ellerman , Andrew Morton , Russell King - ARM Linux , Andrea Arcangeli , linux-mm@kvack.org, LKML , linux-arch@vger.kernel.org, Michal Hocko References: <20171116101900.13621-1-mhocko@kernel.org> <20171116101900.13621-2-mhocko@kernel.org> From: Florian Weimer Message-ID: Date: Fri, 17 Nov 2017 08:30:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171116101900.13621-2-mhocko@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 Nov 2017 07:30:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/2017 11:18 AM, Michal Hocko wrote: > + if (flags & MAP_FIXED_SAFE) { > + struct vm_area_struct *vma = find_vma(mm, addr); > + > + if (vma && vma->vm_start <= addr) > + return -ENOMEM; > + } Could you pick a different error code which cannot also be caused by a an unrelated, possibly temporary condition? Maybe EBUSY or EEXIST? This would definitely help with application-based randomization of mappings, and there, actual ENOMEM and this error would have to be handled differently. Thanks, Florian From 1584310930938471108@xxx Fri Nov 17 11:04:04 +0000 2017 X-GM-THRID: 1584222568854832887 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread