From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8846DA04BB
	for <public@inbox.dpdk.org>; Thu, 17 Sep 2020 16:17:21 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7538A1D660;
	Thu, 17 Sep 2020 16:17:21 +0200 (CEST)
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 714721D660;
 Thu, 17 Sep 2020 16:17:19 +0200 (CEST)
IronPort-SDR: UfyPdp05NeCwsOAf6PitZIH0OrfxzQdMSv21WiFcRBMxlYUTOTLCu1BrylHScIDRCIJplfaDh+
 aRcQ6bsTdZ+w==
X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="177798302"
X-IronPort-AV: E=Sophos;i="5.76,437,1592895600"; d="scan'208";a="177798302"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 17 Sep 2020 07:17:17 -0700
IronPort-SDR: X1xQG6cL2l1iKLKmJSHuK3DEC2RJ8E7Gd+d4zESOHAA55dx3ZuX5aOJaxPTu4E6uCwZsSzxIzQ
 nH4PUlM0s0ow==
X-IronPort-AV: E=Sophos;i="5.76,437,1592895600"; d="scan'208";a="452319795"
Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.206.43])
 ([10.213.206.43])
 by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 17 Sep 2020 07:17:15 -0700
To: David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>, Maxime Coquelin <maxime.coquelin@redhat.com>,
 Sebastian Scheinkman <sscheink@redhat.com>, dpdk stable <stable@dpdk.org>,
 Aaron Conole <aconole@redhat.com>
References: <20200910162407.12669-1-david.marchand@redhat.com>
 <ed178637-e82c-5aab-8094-f9ed60140160@intel.com>
 <CAJFAV8zxm=jNLc+nPt74ZzUp5_-dF9OV=ptfBH5yNZg8EKzJ=A@mail.gmail.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <41283b3a-5591-da2b-dea3-f069248d3265@intel.com>
Date: Thu, 17 Sep 2020 15:17:13 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.2.2
MIME-Version: 1.0
In-Reply-To: <CAJFAV8zxm=jNLc+nPt74ZzUp5_-dF9OV=ptfBH5yNZg8EKzJ=A@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-stable] [PATCH] eal/linux: fix memory allocations in
	containers+SELinux
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

On 17-Sep-20 2:47 PM, David Marchand wrote:
> On Fri, Sep 11, 2020 at 2:46 PM Burakov, Anatoly
> <anatoly.burakov@intel.com> wrote:
>>> Removing hugepage files is done in multiple places and the memory
>>> allocation code is complex.
>>> This fix tries to do the minimum and avoids touching other paths.
>>>
>>> If trying to remove the hugepage file before allocating a page fails,
>>> the error is reported to the caller and the user will see a memory
>>> allocation error log.
>>>
>>> Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>>> ---
>>
>> I believe only the primary will try to allocate new pages, but this only
>> covers the page-per-file scenario. There's also legacy mem option (which
>> would attempt to remove files prior to creating new ones - not sure if
>> it's refused in that case), and single file segments option (which will
>> mostly fallocate holes rather than delete files, but may still attempt
>> to delete files - by the way, how does fallocate work with SELinux?).
> 
> This issue should only concern part of the memory allocator that deals
> with "named files" backed hugepages.
> I would focus on the code relying on eal_get_hugefile_path() and I
> agree I might have missed the legacy-mem part.
> 
> For anonymous hugepages this should not matter.
> 
> 

Anonymous hugepages shouldn't matter, yes, but single-file segments mode 
does fallocate() and remove - you have the remove part covered, but i'm 
just curious if fallocate() would also cause any issues with SELinux.

-- 
Thanks,
Anatoly