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 1EEFC45A51; Sat, 28 Sep 2024 18:48:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE8C14042E; Sat, 28 Sep 2024 18:48:31 +0200 (CEST) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 42FA740273 for ; Sat, 28 Sep 2024 18:48:27 +0200 (CEST) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2053525bd90so29638905ad.0 for ; Sat, 28 Sep 2024 09:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727542106; x=1728146906; 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=qzIajZqw+X2sy1WKHdnFpECxxbc3Yl192G3biWXAiY3Yafi2pJfCd+LQyYnxpmg+lm ywsQom6Bw8UeKZgYgjnyag/Xp6V+h8zxie7EDhvxQ8iUlP6/is30fK2gZPc/ABgdXS2R WA5iUGvknV7syrzp47vG5hDp0QtV4+vaUXqqYamw0igptfFW0rLi0PyJHh+gr/F07ubt /lODF+07ifA9NAxzrYf0mTWmUstY14pF8eYg/PYlcMizGKx4dK/Clgc7Uo1vAaCd+SLS fnZW5akiHsrGFJaNqu0ieHST2jLagBWWjgYSfCQqv6ofcFWK3CiPr8WuS1fYm2EbaNS9 s8aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727542106; x=1728146906; 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=oIcSPKNoYReK79jQDa0mvRmhSj4Xmda2QJZ4BJq3sVawJmNoN6qVjvGDfQ+QOHNkks trpfB2FZ2OYIw4V3sxV+oJp7HCM6mI4fsD+M21lIjYZGhxNlegjvGvjo27ea0XuEfAWH FsVHaoHbFIJLog46c6T41WMwcjIcTj2sS/kFQbKDYGTqpktFrIoiSJRljlO9WALb71y3 gUASDE4xPcDFuxQj20JUT1xhNnCYBViM45mMOL+TZFlPNLO3pLV1uxjLPd/cfmFP1WuJ Ih4AZJMD1i3UF9zj3JzpOm+XecpChjSFwWv6aXixod+r9cLMUCOqujqSNiMwoN2IKcHa dH9g== X-Gm-Message-State: AOJu0YyakTuDQg+yVQoHnJtzkNfoYqc0F/24DsFT3VKmeFKuehDrgYvD /03SdfVAnEbyC/sCbbNqfwnwde4V4f4ZWLf5xd5nBXB/ApKWshj5rApk9fj8ENPUeIPeocAlpv5 / X-Google-Smtp-Source: AGHT+IGwg/SZfoWlYx4yhmcN+E2LWfaExD9dUQ1/bzFS4BxmPRcVC32FiGbw+yE4xK+4yYsbuY+wAQ== X-Received: by 2002:a17:902:ce90:b0:20b:4c02:ee66 with SMTP id d9443c01a7336-20b4c02f00dmr87188765ad.43.1727542106494; Sat, 28 Sep 2024 09:48:26 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20b37e47c7dsm28854015ad.216.2024.09.28.09.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2024 09:48:26 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v2 02/16] memzone: fix use after free in tracing Date: Sat, 28 Sep 2024 09:47:10 -0700 Message-ID: <20240928164814.861933-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240928164814.861933-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20240928164814.861933-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