From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934231AbdKQHbH (ORCPT ); Fri, 17 Nov 2017 02:31:07 -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 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-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 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