From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16B7545CB4; Fri, 8 Nov 2024 16:43:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D00943348; Fri, 8 Nov 2024 16:43:34 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 34FB74025C for ; Fri, 8 Nov 2024 16:43:33 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 8F9521C6D7 for ; Fri, 8 Nov 2024 16:43:32 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 746661C5FB; Fri, 8 Nov 2024 16:43:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.2 Received: from [192.168.1.85] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 749A41C70F; Fri, 8 Nov 2024 16:43:29 +0100 (CET) Message-ID: Date: Fri, 8 Nov 2024 16:43:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] eal: fix cleanup on Windows To: Thomas Monjalon , dev@dpdk.org Cc: David Marchand , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Tyler Retzlaff , Stephen Hemminger , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Chengwen Feng , Konstantin Ananyev References: <20241108130822.4073057-1-thomas@monjalon.net> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <20241108130822.4073057-1-thomas@monjalon.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2024-11-08 14:08, Thomas Monjalon wrote: > The memory allocated with _aligned_malloc() > must be released with _aligned_free() on Windows. > > The POSIX free() was called in eal_lcore_var_cleanup(), Referring to free() as a part of POSIX is true, but a bit misleading, since it's also standard C. > called in rte_eal_cleanup(), and triggered a heap corruption: > exit status 3221226356 or signal 3221226228 SIGinvalid > with MALLOC_PERTURB_=86 > > Fixes: 5bce9bed67ad ("eal: add static per-lcore memory allocation facility") > > Reported-by: David Marchand > Signed-off-by: Thomas Monjalon > --- > lib/eal/common/eal_common_lcore_var.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/common/eal_common_lcore_var.c b/lib/eal/common/eal_common_lcore_var.c > index 0e9e8e4804..a1b2458839 100644 > --- a/lib/eal/common/eal_common_lcore_var.c > +++ b/lib/eal/common/eal_common_lcore_var.c > @@ -54,7 +54,6 @@ lcore_var_alloc(size_t size, size_t align) > current_buffer = _aligned_malloc(alloc_size, RTE_CACHE_LINE_SIZE); > #else > current_buffer = aligned_alloc(RTE_CACHE_LINE_SIZE, alloc_size); > - > #endif > RTE_VERIFY(current_buffer != NULL); > > @@ -108,7 +107,11 @@ eal_lcore_var_cleanup(void) > while (current_buffer != NULL) { > struct lcore_var_buffer *prev = current_buffer->prev; > > +#ifdef RTE_EXEC_ENV_WINDOWS > + _aligned_free(current_buffer); > +#else > free(current_buffer); > +#endif > > current_buffer = prev; > } Reviewed-by: Mattias Rönnblom