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 8B6B245AE3; Tue, 8 Oct 2024 18:49:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACA4340A82; Tue, 8 Oct 2024 18:48:56 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 83C9A4021E for ; Tue, 8 Oct 2024 18:48:54 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20b6c311f62so52068205ad.0 for ; Tue, 08 Oct 2024 09:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728406134; x=1729010934; 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=3za6wZ8c6cAGDHtsy3pNcGcHr7ziS+4gK97QfhFwrwY=; b=TG5y0856N59JtPR8PGPbcnR+tCCwJYG1xGwnVP6nsr/niwIy0UFXBbKAQ8sgk3ZSqv 3un1w4BGTJ1sKnuo3exb+y/eilahoNhGuzsg2sIoPlF89tXGpjWJPHyNI7oRFXKOVUsw K2XFNVGLPFNO60H6FOqttX1fAj7RZYKLnjDzx8nTJgEODBeRhfZjqpTAuJxhBh4rs2M8 T7/UDvrvc0HNV3GJ9J+lwFnl7MI++VNm0MZB4FVkpWhbrgXCUc1rtemxDsSbPS2D1EjV yb3R95L+m2YBHv1nl6SgfQT23oRG5qwHdLhwnQfA7LGe76f/7rX0cbLvMT0JygHUAaHQ r8/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728406134; x=1729010934; 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=3za6wZ8c6cAGDHtsy3pNcGcHr7ziS+4gK97QfhFwrwY=; b=Rtkzp9TH1NGmaFuX773mEkv5z+tJgicSLRJ5y89F4IGX7DP5WlDk2t+aWIxUxHU5qq ye7dlz9V7XqhbGBAm9lG6qQ76wPaMUGoC1SebrXBBl+rVmhMpgGHGeb0hxwVMyv5y2Na AXzzml2X5HEWN0PWvbdbQ0d89+7DWx9wIWjUTLbU8JqjPgzVmsj2hocwVWyLODnlpupq irKnQKw2a9aYI80bPb49G1PZuUxyziwSmMOFUcsyF5p7BqUv3JIE7ojYkM4GIO+i8TI8 9WrJvPyTWGXJN/iXthdHEti60bJjJAjjOynrml9hOxZV3QtPF7rH3nxDqHjf/f004lka mk8Q== X-Gm-Message-State: AOJu0YxsYXoIhKwimdYEJME3XQywVq+y+5tThsE5N21i5Ewdg5nfgrSU EfQcm6dNNk/v0yr8K1zsd6noWK9XXLTGoEUgE9cZe1hH9Chqupjl2k1IGSE6Mm83Gmp/HWsA8zt HRel9Jw== X-Google-Smtp-Source: AGHT+IHphPPksiOavWahihn7IBbh8GYox2U2eWwg2M3rb/SfikTVoMV6ONWKMKcagGjFmQAPies8bw== X-Received: by 2002:a17:903:41c5:b0:20b:6a57:bf3a with SMTP id d9443c01a7336-20bfe022775mr183311145ad.1.1728406133682; Tue, 08 Oct 2024 09:48:53 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c54056bd9sm13832965ad.85.2024.10.08.09.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:48:53 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v9 01/17] memzone: fix use after free in tracing Date: Tue, 8 Oct 2024 09:47:05 -0700 Message-ID: <20241008164842.139045-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241008164842.139045-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241008164842.139045-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 Acked-by: Anatoly Burakov --- 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