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 026B945AA0; Wed, 2 Oct 2024 20:39:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CB00402AF; Wed, 2 Oct 2024 20:39:31 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 98337402A7 for ; Wed, 2 Oct 2024 20:39:29 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71979bf5e7aso128532b3a.1 for ; Wed, 02 Oct 2024 11:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727894369; x=1728499169; 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=oQCYJDCDp7RUroO5o4Y4aTAPEINydkwhBjY2go9h9Rgvj+1SVyF+ehQz8orezxZfYR uGabTKh2W31IS0ZjhMWqzVbl6z4Cccvs9RQ5CHwyfiI5Ba18BS7klvi7cEahMi8zz/3e LnP8kOfH1OwdS0L77IN3hOg5cnkHvBEgP43C6G4dPMj9y/ZTZhq7vZiS1wFuDq/uWfeB r8FWoQMc1jn9I/Llc+dxW6roxLkACMw9VX5Y9DF4FX7vsGmd06U8OLO32QJxjuNR4jJq Yd63v0jzJGMncQDpbdBTCjCQuyqb66DWYGp5ft1SaAJQWaPEuX4Msw44rbK5r72Y2891 5pIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727894369; x=1728499169; 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=aV3/LOVi/d9qfduDVPhEyPZZdtjiKvFhpCa9C0jsjSNYVTsgSf/3Fvy/hma2bYHcF1 eSzi/x39p7SfVYvdiD82ZEixm6iUE623TBbTu2BiYgFNI9yKgT4hK6X2tTgHlViXVVGp mQsgH8PkV4nC0DGtnEVoUQSIjUXQ25NJUWDr9mZMkJqPDNx7o7L+Lbvwn6a8tZB+gzQ/ 7Irbwtq3fCwtzURomw96QRV+PPEdqcYtk5xqmqgOWyAPZONvVNtizxnNsWNzvfn61vMO hV1esSkr1UR6mCrjqDFY9UH2FZUgFXbHskWsScMfIpvmoNPTNT//FgMEA4tDmni0AtSU 7BFQ== X-Gm-Message-State: AOJu0YwWZS1gHX9qPSZfTmmFcRrQyBigARbwFmis4cFzmQO0lQHyB8P+ 8F+uVi4GTpdhkdoSIwlzj+xf6i326MD/suqQUMXUyCK9nMxp0zioAcqdWWr3nMGtp8QR+4/AKZV I X-Google-Smtp-Source: AGHT+IG4SZvpn0MQxTLF50zW3WJlrcr2cPDkPOo4uu5hKNHR6/w/Zdmy4JhTeywxmhaKdTsh0ZKuMw== X-Received: by 2002:a05:6a00:1707:b0:719:8f90:5bae with SMTP id d2e1a72fcca58-71dc5d6e9e4mr6158337b3a.27.1727894368736; Wed, 02 Oct 2024 11:39:28 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b2649b0bdsm10104362b3a.34.2024.10.02.11.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 11:39:28 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v7 01/16] memzone: fix use after free in tracing Date: Wed, 2 Oct 2024 11:37:39 -0700 Message-ID: <20241002183918.161656-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002183918.161656-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241002183918.161656-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