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 A87FF45A48; Fri, 27 Sep 2024 22:48:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2532D402F0; Fri, 27 Sep 2024 22:48:02 +0200 (CEST) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by mails.dpdk.org (Postfix) with ESMTP id 0CE5D40144 for ; Fri, 27 Sep 2024 22:47:58 +0200 (CEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7198de684a7so1876812b3a.2 for ; Fri, 27 Sep 2024 13:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727470078; x=1728074878; 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=s49kYe8IdGCDB5sRle5nN6GPJxL776RcDbLVjlL25DraaMVPJxloKR3riGPIhgae9M bm3wcxkdzgTayJxMV/y0KC0hTz50CCd7NpR0iGFqytZMIwpxEOX0p++eJvqc0qw09qsM EweHVaBENh5xWpXfUFT6SkzIMQYH9EYF5zfX4cG+TntPD9Ux77PZ62AoKAvAs015+7cC Ij91IxOoE1AYqHIyfRG9v8OlsFiZa7LFXNU46GElCapYHbAmeFz35SuNxQyYIkdpiHLp abXrdYziNy7r0r4BvS3/T4xCZ/OAvI/fQ0dQ984r6Z6HACA8mOjqYjZCF2c5ZZmYD2Av Nr2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727470078; x=1728074878; 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=QQp9cXK/t+0I9wCRCfKD2L4cIFhVzfehp+RwJIISwc6mWTG8R3aqf8PZsDx4HUbEaf xefgTBViauS+qICrqZ0ERfdo2dThxe8nzrz1g6+PZ73U1pE3vvc221uc56nMStEkUCyF 3aku2b9Mq9ErBaYSeTzCsNENJZ67gF4iO8Q768xefPrWjnptyB5Qz+Z4YQmaqDCqgs3X fJAuVS6eW7wvwfmxg8R9vwkJf+t7S/TQy+qIj1GuhZR/UgKoOI+6iipXwJqyBJgmRPn+ bpzit/bIHFksvNlZTqp8cN+u79TDcBFYLehXFnbA5jFZ/PWQpRyEZD4W7DbmLTCbuOyp 4c7A== X-Gm-Message-State: AOJu0Yw43pIxwxGWGoUhabuH1uIg2tjLWgW3EMn76yoDKyY4bKjFZHca 7WLf7GLPoMLW6qgx8z2kJlYB50Pp0oI+zKY541bFphpPJrKSwYvuL3vca14oc5pvsmqhncmHzDZ X X-Google-Smtp-Source: AGHT+IFB1q1hcXdbUviuqQAtsejVaEG7PfMP5Fu+VUYVyFgkoRfqbbRascIfNuXjP0N6UdY5+oNMZA== X-Received: by 2002:a05:6a00:2396:b0:717:93d7:166b with SMTP id d2e1a72fcca58-71b26079c1bmr6913621b3a.25.1727470078012; Fri, 27 Sep 2024 13:47:58 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db294533sm2036531a12.12.2024.09.27.13.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 13:47:57 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH 02/16] memzone: fix use after free in tracing Date: Fri, 27 Sep 2024 13:45:38 -0700 Message-ID: <20240927204742.546164-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927204742.546164-1-stephen@networkplumber.org> References: <20240927204742.546164-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