From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [dpdk-stable] [PATCH v3] mem: fix undefined behavior in NUMA code Date: Thu, 04 Oct 2018 00:36:47 +0200 Message-ID: <1780284.rQHulcP352@xps> References: <7e4178219213303b982e505ae4cb4387d9d3814a.1537447684.git.anatoly.burakov@intel.com> <2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com> <20180921110038eucas1p1185f3275e6d99f285f44a299dd3b210d~WZT3JUk-I2589925899eucas1p12@eucas1p1.samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: stable@dpdk.org, Ilya Maximets , dev@dpdk.org, solal.pirelli@gmail.com To: Anatoly Burakov Return-path: In-Reply-To: <20180921110038eucas1p1185f3275e6d99f285f44a299dd3b210d~WZT3JUk-I2589925899eucas1p12@eucas1p1.samsung.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 21/09/2018 13:02, Ilya Maximets: > On 21.09.2018 12:27, Anatoly Burakov wrote: > > When NUMA-aware hugepages config option is set, we rely on > > libnuma to tell the kernel to allocate hugepages on a specific > > NUMA node. However, we allocate node mask before we check if > > NUMA is available in the first place, which, according to > > the manpage [1], causes undefined behaviour. > > > > Fix by only using nodemask when we have NUMA available. > > > > [1] https://linux.die.net/man/3/numa_alloc_onnode > > > > Bugzilla ID: 20 > > > > Fixes: 1b72605d2416 ("mem: balanced allocation of hugepages") > > Cc: i.maximets@samsung.com > > Cc: stable@dpdk.org > > > > Signed-off-by: Anatoly Burakov > > --- > > > > Notes: > > v3: > > - Fix potential memory leak if socket-mem was not specified > > > > v2: > > - Improve readability as per Ilya's comment > > > > lib/librte_eal/linuxapp/eal/eal_memory.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > LGTM, > Acked-by: Ilya Maximets Applied, thanks