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 00A6D45A5D; Sun, 29 Sep 2024 17:41:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B196402BD; Sun, 29 Sep 2024 17:41:22 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 0EF43400D5 for ; Sun, 29 Sep 2024 17:41:20 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71b0722f221so2748435b3a.3 for ; Sun, 29 Sep 2024 08:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727624479; x=1728229279; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TMGxOfORgNYeQMB92D3aLopJwJhBzDDfOXuG4U/9wME=; b=clXNC+vSbovpxwgvlpXgkiwTSatzJlQcHqjPJDjwkkJaSjrikUqgetG4+mLgdOoez2 NZ8z2wOVwg9wKwD8fFtxOBtr9quwtwynGGQGCzon8jv9Lmv0e5DDcENwDT4CHTQUvsPF e/6mpBQ4MgWjNoqlGVy0xDRhBAGCR9dPjyPJruzkFlkmIV0T1NQxTWgfH/FgBsHrojR3 +PbMW+IalZ/YDDnLwBWjCYgJeFK0d4CDH4TNLAtLNms3s6ilosps+vsl6v/OBW6EUP5D Dz3Sc7odrnh8Lg2iq2O3+xWLe8DHYd9wnvxfFtS71on3FZKXelpxt9+9YJWiSGvZGJe2 qUEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727624479; x=1728229279; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TMGxOfORgNYeQMB92D3aLopJwJhBzDDfOXuG4U/9wME=; b=Fq6RHjXl/mmkWZaqt+vDOAoF2GfuzrgitcGGGgN2ui/KAoVI18X7/myrWWFk8N+1r+ AY+zhXG+yr7/omkxhPdiR/pGkxOsRpNUtUlY+2Pn23+IgWoEZP8LmJkSuAf7m7tbZOil 1G0dpxqu3dRjtcwiR5UBE62ddQG1YXKQ0ekFHeXvctGHeVVO4EOpqbc9SLihzR7Jd0c7 fSlqOk0yW0JGrbGCzHtt6Llah3uRh/6hF57c+SUkT+3OMVvuwR2vCpvbbsDqPQga8dE5 H9au3XqAeJ5FQ8mv4gZPtKHEGh4mZZjipREUcQv7T1Sa8gYXMQDofaXZbnKp1zf24Vys 8XPQ== X-Gm-Message-State: AOJu0YyXNVzuf/xWemo3lF/KPmXKnNQ/UXngArVzuQ3bOejdhhyaqCc+ 8AC3PD1DTIUUJhigWXOQmj+QBmdt6hrsKnkvV3WVv5sbkDkL7HH77L4p4wrBNOg84+CI2iRCPnb 4/oQ= X-Google-Smtp-Source: AGHT+IE07UcMYgz9BLbxrhb45p6eaagxXYolDfI5R+Zh1MehmXlrOmOz8EqbInVwta5SscqfdJMKhg== X-Received: by 2002:a05:6a00:4b01:b0:714:291d:7e47 with SMTP id d2e1a72fcca58-71b25f45e35mr15324865b3a.10.1727624479185; Sun, 29 Sep 2024 08:41:19 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b2649c775sm4707416b3a.29.2024.09.29.08.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 08:41:18 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v3 01/18] memzone: fix use after free in tracing Date: Sun, 29 Sep 2024 08:34:26 -0700 Message-ID: <20240929154107.62539-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240929154107.62539-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20240929154107.62539-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Using the freed value for tracing is not a good idea. Although it is harmless for tracing, it will cause analyzers to flag this as unsafe. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_memzone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 2d9b6aa3e3..90efbb621d 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -331,9 +331,10 @@ rte_memzone_free(const struct rte_memzone *mz) rte_rwlock_write_unlock(&mcfg->mlock); + rte_eal_trace_memzone_free(name, addr, ret); + rte_free(addr); - rte_eal_trace_memzone_free(name, addr, ret); return ret; } -- 2.45.2