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 42CE845A6D; Mon, 30 Sep 2024 20:46:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE2D2402D3; Mon, 30 Sep 2024 20:46:14 +0200 (CEST) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mails.dpdk.org (Postfix) with ESMTP id B8B434014F for ; Mon, 30 Sep 2024 20:46:11 +0200 (CEST) Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7e6d04f74faso4052714a12.1 for ; Mon, 30 Sep 2024 11:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727721971; x=1728326771; 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=7paBrPWp2Y8mwdoOQ5QSBqcUqCcWCveG1D8UUovfoXc=; b=rhR+8l7FE6vZro8grJu4qWCtYSyV8fM8GPdCdL6EUe8fvwICAPokRukFnxpDtI/2/q 1aVqmVlP7fQTIfo+FsoKHuxepc8EcILcXnoHozlP7UUCyLxmoXzr0fi7RQirvb+/mpB3 /diFwcuwZrS/p/zWKUMKlpC32tM23u+kSSxhc2wpWjrN4YXcOYl08ntesQDr1f/n0AZx 6FIV3oQbhBlgZQj2L9TgWdCRBp+BojUJJFe/TVFwr7gcRMbnLPr79KC/48DEOrOgWcNJ K1ygF8NV0K7daySsZ8wd9C/JrvsLcBjxwPY/dGuJSbi4lBma2PCxfT6eypnngeo4vt8r kPFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727721971; x=1728326771; 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=7paBrPWp2Y8mwdoOQ5QSBqcUqCcWCveG1D8UUovfoXc=; b=prHW0azlp1Rqv9S2TrZbO2UCnmSUF6mSPYvl6MgZVHQbiMqJoSMFcaHCG2oNibXA6L DSBb4D04BfJLzpGR1CV3OcvCOdbcjrGTgrhfq/l6EtlHTml/CsKL6gaWKXLWkftQn6qE twnrKSd98SlIx8NK+46vM77P9+paHEBdLvd0d7CzAU/jvMjMk72to1lXdbh2H9IKFaWv I82wiHTs0oF9kGkXy5hI93k41SflQLO1+n3OjPmXxehnleYYndB69xAKv3gVXmaYW82k dlWuXp2lid/BcsJxt4y2AGzYvXzaNjORXNkGAx01xXSj+ANZDx+oEgugY82cdA+wN/tm kx8g== X-Gm-Message-State: AOJu0YwwVIrvWTv5VirWaJBrdKKoYnZSUs/BNZ6igUqBI/5mG+2W4UBF Jg1DxZAuDp6PRHrHkAjimuQKIFlclxeNTptuIKWPXFDZhHbsu8kLnYuCTzldQTc8Ymwr/5B7Gi6 5K6pdGA== X-Google-Smtp-Source: AGHT+IGde/DcbSYiMuDXldtGI6Jq8Px626jORrnbJngGuYBQaJwNarbzLFFn8L3Kg0zwmdx/m102xg== X-Received: by 2002:a05:6a20:b58b:b0:1d2:fad2:a537 with SMTP id adf61e73a8af0-1d52d127154mr995860637.18.1727721970853; Mon, 30 Sep 2024 11:46:10 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b264bcca6sm6581895b3a.78.2024.09.30.11.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:46:10 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v4 01/17] memzone: fix use after free in tracing Date: Mon, 30 Sep 2024 11:43:55 -0700 Message-ID: <20240930184600.7092-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930184600.7092-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20240930184600.7092-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 Acked-by: Chengwen Feng --- 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