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 B4C4445AE2; Tue, 8 Oct 2024 17:43:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE04B40691; Tue, 8 Oct 2024 17:43:15 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 121E84021E for ; Tue, 8 Oct 2024 17:43:13 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e1a715c72so278578b3a.1 for ; Tue, 08 Oct 2024 08:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728402193; x=1729006993; 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=exqNfp2ccrD7P9jcO8fEPz/fXFe0WB6/H5AIJetll1vzMXM7uy+aiQET5fDd2uM6dH D6g9cn1JpTfBvNJCHyHQJNTbQlfQKAYQYEwUzpvY0IInq4o6OMJYXLkoOr11CTnOX6Is UGu50WKO9ksg+S2E/ujwVRW45tZuXXMjloEHIYKAIc9CaWNkZzeyQgKsRnUVK+eJ59G+ u7GcAmYF8byc3WxZPAlzuJgsQIHjEntqnoVXDLYWyb5DslqKdEj8YMuthDQlFNcB0Q9D X7v38gHPNqvg641uHHFzYxnfPQRrfocr9dE+Thuao4e2iCt+bMni/lAl7uiBeUHBrmWz cYkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728402193; x=1729006993; 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=Xv5zul4MIqDlhi8Qb5GPxKcb73vaHSW3F8aSxBdDNu08FGCdvlicpEvwZWj0f5hNea cNUmE8EINvV5S8Ve4Ow+zRt87QB8DYhMvmLQxZM60KJ5ZB6kJM6Z9onvsjGB5bxSFHbd AX4NO6FHLhdUurF6EmXuN7Gkw+CWis5GLee55AhY7H6W3L9+MH2/B7EUZhx5ffFLCJSu L21v5MWvqeuDf9HL9GIiF+VF8nO3lSjtp37Za9b9KOnHp6Vg+KUJVApMCDIfWhUcEZqL pDE4jKSnJZ4/hPBGhv369SN2WV1eq7W43Y7D0rakCvmZ5/gCSjzTudnHf+tm63ch3RdR 3lYw== X-Gm-Message-State: AOJu0YyH8nvt1wluBpIZfx1r5zfsrnbss40ewN/QAwixUQn6gvVOe8n5 LjFeQItYnZQ+J0FZK5J0+zyPYXPimnRDuak9Oe0wPh6EW4zSSi01BTorpDxsEqiqVKiMrHK7CgC udFNyVA== X-Google-Smtp-Source: AGHT+IEtoMlJjmh0ed1sMMR8MD5t/RnoNZN5ennoXOvJ8Pcsn4p0tcfxeHOoQw50rq7OiYI9Qitghw== X-Received: by 2002:a62:bd16:0:b0:71d:f27f:a86 with SMTP id d2e1a72fcca58-71df27f0e88mr14881784b3a.19.1728402193191; Tue, 08 Oct 2024 08:43:13 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0ccf01dsm6293527b3a.70.2024.10.08.08.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 08:43:12 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v8 01/17] memzone: fix use after free in tracing Date: Tue, 8 Oct 2024 08:41:31 -0700 Message-ID: <20241008154301.66192-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241008154301.66192-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241008154301.66192-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