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 0D9C245A9E; Wed, 2 Oct 2024 17:44:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20E9D402CB; Wed, 2 Oct 2024 17:44:42 +0200 (CEST) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by mails.dpdk.org (Postfix) with ESMTP id AD9864025C for ; Wed, 2 Oct 2024 17:44:40 +0200 (CEST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-277dd761926so4019449fac.2 for ; Wed, 02 Oct 2024 08:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727883880; x=1728488680; 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=fgiTzU+vJQeJk00d5ZZDsjJHdS3bNiXgHoVTxwf6Ug9c4ebGqxh6sVX11Gvw1Pxe2w t8KqYxDtMWBSGCYcb46OcPAEYESxgJqYpKMdJHx3RsUoOg0cSa/p/huYTwmoxjWYZUr/ 5uRFsc4QqzO99f54Rryr2rsZLujUIhGKvZ9SZNdCx4MeYFiVC0bVT/MwQUPBZSIhF1Ky ywL8bibDj7yLLblW5Bsb0AKtWOkFoynAegvhlICWesGLAoRf8pJLV5Vrie9cHg1faIyu uLO4JGtrUU/h3VryJcpry9mumjC+MDIMnQlNqDWJKnRsKDVVGDJ1g4t//UUs2RPuhD8+ VW8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727883880; x=1728488680; 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=gr08iNIn0ugrKXKUoYntxOnkJv3tPjghwJAXwiyEYE8861K8cQSVtzozkNQlFnVQaj 8dd1sPSP75KXcOSfa7zRXeXTpr8dKztYbRxB29+IYgBOqt0BXhCd9hv0Fx+wy1fsBgCk WSn44PuDxhCoToi5pCLGUCnwPWKOM7nEudYSt//Z2RU9qV8tDviQxs20Eei5g50KcvQS H1ftL3EBmd1p7lYB0VRJrLRURkRFzPtfYKunZlZyazRefj578/ggrTBx68jLBmhHcZ2O 3bHA1pGBqSa6fabzwoD0zWw8fZOCuPR5a+X9rkO/kgSue/A/28aARxGwnKlYcjSV18As X2Lw== X-Gm-Message-State: AOJu0YyyCMOMi9Yd+YQuVpGLm0zu8Qo1FFpnhyMa7sm7WdSLppl2JJX5 Wwu5T7WrqHfz8Gkp+Ob/Z916Lg+/YZaFtrUOBt1ZXTnI0WjC94Fyqsre3TwU+uZngm8146pUsBM oXNY= X-Google-Smtp-Source: AGHT+IG6NRuAfU5TJvzUL8ScdZboM7PRbpmf9Gk5PEso9gv9wDu469bonK/7UjgsM2FWdEWUwuu2aw== X-Received: by 2002:a05:6870:6590:b0:287:7695:6a87 with SMTP id 586e51a60fabf-28788a2ee48mr2619412fac.10.1727883879885; Wed, 02 Oct 2024 08:44:39 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db2927c7sm10247363a12.1.2024.10.02.08.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 08:44:39 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v6 01/17] memzone: fix use after free in tracing Date: Wed, 2 Oct 2024 08:42:45 -0700 Message-ID: <20241002154429.64357-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002154429.64357-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241002154429.64357-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